Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Rendering a page break in WinForms RichTextBox

Rendering a page break in WinForms RichTextBox

Scheduled Pinned Locked Moved C#
csharpwinformscomtoolstutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    The Man from U N C L E
    wrote on last edited by
    #1

    I have a project that integrates RichTextBox tips from many articles across the web. Everything from XP Style borders, to WYSIWYG printing. One thing missing is rendering of page breaks. I can insert an RTF page break that is visible when loading the resulting rtf file into Word, or similar. However I can't find how to render it inside the RichTextBox. I would like to render a nice dotted line at that point. So far my searches have only turned up print rendering articles, which I already have. Any suggestions or links to appropriate aticles would be welcome.

    If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

    L 1 Reply Last reply
    0
    • T The Man from U N C L E

      I have a project that integrates RichTextBox tips from many articles across the web. Everything from XP Style borders, to WYSIWYG printing. One thing missing is rendering of page breaks. I can insert an RTF page break that is visible when loading the resulting rtf file into Word, or similar. However I can't find how to render it inside the RichTextBox. I would like to render a nice dotted line at that point. So far my searches have only turned up print rendering articles, which I already have. Any suggestions or links to appropriate aticles would be welcome.

      If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      This is what I know about the matter, mostly from reading the RTF specification and from experimenting (I did quite some work on tables, perfectly readable in WordPad): - there are hundreds of RTF commands; - Word can create RTF documents, and will use a lot of the existing commands; - WordPad can create RTF documents, and will use only few of the existing commands; - WordPad can show a lot of RTF stuff it does not let you create interactively; - RichTextBox shows RTF documents pretty much the same as WordPad does. - RTF has a \page command - WordPad shows it as an empty line From that I would conclude: - by default RTB hardly renders a page command - you can of course add whatever text and formatting code you like whenever you also insert a page command; that is after all what Word does when it creates headers and footers for you. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read formatted code with indentation, so please use PRE tags for code snippets.


      I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


      T 1 Reply Last reply
      0
      • L Luc Pattyn

        This is what I know about the matter, mostly from reading the RTF specification and from experimenting (I did quite some work on tables, perfectly readable in WordPad): - there are hundreds of RTF commands; - Word can create RTF documents, and will use a lot of the existing commands; - WordPad can create RTF documents, and will use only few of the existing commands; - WordPad can show a lot of RTF stuff it does not let you create interactively; - RichTextBox shows RTF documents pretty much the same as WordPad does. - RTF has a \page command - WordPad shows it as an empty line From that I would conclude: - by default RTB hardly renders a page command - you can of course add whatever text and formatting code you like whenever you also insert a page command; that is after all what Word does when it creates headers and footers for you. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read formatted code with indentation, so please use PRE tags for code snippets.


        I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


        T Offline
        T Offline
        The Man from U N C L E
        wrote on last edited by
        #3

        Thanks Luc I am using the \page command and it works fine when printing or loading into Word, just no visual cue in the RichTextBox. I hadn't realised WordPad did nothing to indicate the page break. If Microsoft left it out of WordPad I don't feel so bad about not implementing it myself. I guess the simplest solution will be for me to insert a horizontal line in place of any page breaks and replace them with real page breaks on save.

        If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

        L 1 Reply Last reply
        0
        • T The Man from U N C L E

          Thanks Luc I am using the \page command and it works fine when printing or loading into Word, just no visual cue in the RichTextBox. I hadn't realised WordPad did nothing to indicate the page break. If Microsoft left it out of WordPad I don't feel so bad about not implementing it myself. I guess the simplest solution will be for me to insert a horizontal line in place of any page breaks and replace them with real page breaks on save.

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          You're welcome.

          The Man from U.N.C.L.E. wrote:

          insert a horizontal line ... and replace them

          That sounds OK. Whatever you want to achieve, it probably can be done, but you'll have to manipulate the RTF string yourself. FYI: as always, the document Word generates is overly complex; WordPad does a much better job, assuming it allows you to enter what you need. When working with tables, I looked at what Word does, read the RTF specs, and created it all in code, I didn't want hundreds of lines of initialization (and it gets worse in every new Office version). :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read formatted code with indentation, so please use PRE tags for code snippets.


          I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups