This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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 ]
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )