RichEditView Page Breaks 
Author Message
 RichEditView Page Breaks

I know this question has been asked before, (I have looked everywhere) but I
still can not find a good response.

I am trying to create my own RichEditView based application that can
recognize rtf style page breaks when in Print Preview mode or Printing.  I
know it can be done because the WordPad.sln that comes with .NET handles
page breaks embedded in RTF files.

Here is my set up ---
Microsoft Development Environment 2002    Version 7.0.9466
Microsoft .NET Framework 1.0                    Version 1.0.3705
Windows 2000 Professional                          Version 5.0.2195 SP 2
Build 2195

Create a simple rtf file in Word.  Something like 3 lines of text and insert
a page break between each line.  Save the file as an rtf file.
Open the file with WORDPAD and look at the print preview.  Looks good.

Now create a new solution based off of RichEditView.  Build it and open up
the same file you just looked at with WORDPAD.  Notice how the Page Breaks
do not appear in the Print Preview.

I have looked all over the WORDPAD source code to see what they did in order
to recognize page breaks but I just can not follow it or figure it out.  Can
anyone point me in the right direction??  PLEASE!

Duston



Sat, 08 Jan 2005 22:06:56 GMT  
 RichEditView Page Breaks
The appalling lack of documentation is indeed a disgrace and only lends
impetus to Open Source replacements for Microsoft Windows operating system.

To start with, the RTF page break control character is DISABLED  in the Rich
Edit control.

I've never seen a reasonable explanation why.

Secondly, I'm in agreement with you that the source code to Word pad
is ALMOST WORTHLESS for seeing how to do things in your own app,
particularly if you are comming to it for the first time.

Thirdly, most Visual C++ books ignore or avoid the subject entirely, instead
concentrating on the better documented features such as how to have pretty
colors in your window or how to have colored text
etc. etc..  Try searching the books on the terrifying subject of Print
Preview of a RichText control.   The results are pretty meagre.

Lastly, you are compelled to search Microsoft's labryinthine web site, or
else the whole Internet, for snatches of information on how to do it.   You
will find somewhat more helpful information on Borland language websites,
particularly Delphi, and then must translate the given info into C++.  It
was in such sites (and NOT on any Microsoft website) that I discovered to my
astonishment that the reason I was getting 30 blank pages printing out from
my app from a CRichEditCtrl running on a Windows 2000 system using code that
formally worked on W95-98 was that the WM_GETTEXTLENGTH message needed to be
changed to EM_GETTTEXTLENGTHEX on any systems running W2000.  Ha ha!
Surprise!!!!!   Hey, thanks Microsoft, the docs about doing this can be
found right away on your web site... (NOT).

Anyway, the basic idea is that after getting the total text length of the
text in your RichEdit control,  you  create a loop and Send a FORMATRANGE
message to the control with certain paramters in the SendMessage set to tell
the control to paginate the text.   It returns the location of the character
that starts a new page.  The loop continues until you reach the total text
length, and you save the start of each page on each pass of the loop.

I'm going by memory on all of this but the details will be found in the MSDN
code example which is provided (once you find it).

Search for the relevant code example on MSDN using FORMATRANGE and
WM_GETTEXTLENGTH in your search id and you should find it.

Experts, corrections welcome on the above points!

Perhaps with the advent of the new .NET juggernaut, there is some better
way.

Jim


Quote:
> I know this question has been asked before, (I have looked everywhere) but
I
> still can not find a good response.

> I am trying to create my own RichEditView based application that can
> recognize rtf style page breaks when in Print Preview mode or Printing.  I
> know it can be done because the WordPad.sln that comes with .NET handles
> page breaks embedded in RTF files.

> Here is my set up ---
> Microsoft Development Environment 2002    Version 7.0.9466
> Microsoft .NET Framework 1.0                    Version 1.0.3705
> Windows 2000 Professional                          Version 5.0.2195 SP 2
> Build 2195

> Create a simple rtf file in Word.  Something like 3 lines of text and
insert
> a page break between each line.  Save the file as an rtf file.
> Open the file with WORDPAD and look at the print preview.  Looks good.

> Now create a new solution based off of RichEditView.  Build it and open up
> the same file you just looked at with WORDPAD.  Notice how the Page Breaks
> do not appear in the Print Preview.

> I have looked all over the WORDPAD source code to see what they did in
order
> to recognize page breaks but I just can not follow it or figure it out.
Can
> anyone point me in the right direction??  PLEASE!

> Duston



Sun, 09 Jan 2005 15:17:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. lint on Altos 2000 is BROKE BROKE BROKE!

2. Property pages broken? How to fix

3. Page Breaks

4. apache ProxyPass breaks with .NET aspx pages

5. Page break in RichTextBox

6. Need to find page break in code

7. hell with page breaks

8. FileStream in aspx: can I program page breaks?

9. Page Break

10. forcing a page break when printing with RichEdit?

11. CRichEdit force a page break when printing?

12. Page breaks when printing source code

 

 
Powered by phpBB® Forum Software