Break page in a RTF document (RichTextBox New Page) 
Author Message
 Break page in a RTF document (RichTextBox New Page)

I read the Rich TextBox does not support the full RTF library
How can I insert (programmatically) a Page  Break into a RTF document I am
creating in VB5-SP3?

Is there any sample code to manage more completely the RichTextBox (i.e.
printing margins) besides the MSDN examples?

Ciao,
   Giovanni

---

To reply please remove 'INGO'.
---



Tue, 21 May 2002 03:00:00 GMT  
 Break page in a RTF document (RichTextBox New Page)
Giovanni Buommino schrieb:

Quote:

> I read the Rich TextBox does not support the full RTF library
> How can I insert (programmatically) a Page  Break into a RTF document I am
> creating in VB5-SP3?

Try: RichTextBox1.SelTextRTF = "\page"

--
Andreas Hofmann




URL  : http://home.t-online.de/home/hoffman



Sat, 25 May 2002 03:00:00 GMT  
 Break page in a RTF document (RichTextBox New Page)

This doesn't work...... just puts "\page" in the document as text..... so
far as I know, there is no way to insert a page break into a rich text box.
Let me know if you find a way.
Mike

Quote:
> Try: RichTextBox1.SelTextRTF = "\page"

> --
> Andreas Hofmann




> URL  : http://home.t-online.de/home/hoffman



Thu, 30 May 2002 03:00:00 GMT  
 Break page in a RTF document (RichTextBox New Page)
Hi -

The end of an .rtf file saved or written out of a RichTextBox is the
sequence (in hex) of 7D 0D 0A.  The 7D (close brace) denotes the close
of the rtf code.  Anything that follows it in the file will be ignored
by an RTF reader such as the one built into MSWord (although not the one
in WordPad).  The RTF control code, "\page ", is indeed not recognized
by VB, so the trick is to sneak one into the output file in front of the
final "}".  Here's a hack that works:

        Open "Filename.rtf" for Output as #2
        RichTextBox1.SelText = "Some text...."
        Print #2, Left(RichTextBox1.TextRTF, Len(RichTextBox1.RTF) - 3);
        Print #2, "\page ";
        RichTextBox1.TextRTF = ""     'Blank out the RTBox
        RichTextBox1.SelText = "Some more text on a new page."
        Print #2, Mid(RichTextBox1.TextRTF;
        Print #2, "}"
        Close #2

That's good for only two pages.  A more general hack for NumberOf pages:

    Dim iPage As Integer
    Dim NumberOf As Integer
    Open "Filename.rtf" For Output As #2
    Print #2, "{";
    For iPage = 1 To NumberOf               'Or whatever terminates the job
        RichTextBox1.SelText = "Page " & CStr(iPage)
        ' . . . Fill the RichTextBox with a page full
        Print #2, Mid(RichTextBox1.TextRTF, 2, _
            Len(RichTextBox1.TextRTF) - 4);
        If iPage = NumberOf Then Exit For   'Avoid extra page
        Print #2, "\page ";
        RichTextBox1.TextRTF = ""
    Next iPage
    Print #2, "}"
    Close #2

HTH
Bob

Quote:

> This doesn't work...... just puts "\page" in the document as text..... so
> far as I know, there is no way to insert a page break into a rich text box.
> Let me know if you find a way.
> Mike

> > Try: RichTextBox1.SelTextRTF = "\page"

> > --
> > Andreas Hofmann




> > URL  : http://home.t-online.de/home/hoffman



Thu, 30 May 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Break page in a RTF document (RichTextBox New Page)

2. Saving page breaks from Word documents to text documents

3. Sending a page break to RTF control

4. Page breaks in RTF control.

5. Page Break for RTF

6. page breaks in RTF box

7. RichTextBox and Page Breaks

8. Q: Page break in RichTextBox?

9. Page break in RichTextBox

10. Page Breaks in RichTextbox

11. RichTextBoxes and Page Breaks

12. Page break in RichTextBox control

 

 
Powered by phpBB® Forum Software