• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to add "page break" in java output file?

 
eric zhao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to find a way to add page brak or underline those kinds of print control characters in my java output file. However, it seems impossible in ASCII and I didn't find a way in unicode either.
Anyone could help?
Thanks a lot.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've worked with the byte-level (binary) formats of both Word's DOC files, and Rich Text Format (RTF) files.
The simplest way to implement a page break as you would like is to insert unicode character 12, which is a form feed (FF) in ASCII and UTF. This will be interpreted by both Microsoft's Word and the WordPad application that ships with Windows, and a page break will be inserted correctly. You could achieve this in the following code:

However, by not specifying the entire format of a Word document, you may be opening yourself up to some potential problems (including an annoying Word installer dialog), but then I leave that with you...
The alternative is to output the format into a character-set independant format such as RTF, which uses the string "\page" to represent a page-break. Again, you'll need to put in the appropriate headers to avoid any errors.
Let me know if this helps!
[ June 05, 2003: Message edited by: Charles Lyons ]
 
eric zhao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, Charles. I will try it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic