Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Append two rtf files into one rtf document using io stream  RSS feed

 
Ramya Thyagarajan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have two .rtf files generated as part of my application.

I require to append these two files and generate as one single .rtf document

The normal method of appending files in java does not seem to be working.

The Outputfile does not write the contents of the second file. Kindlly help me resolve the issue.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is correct behavior. RTF is a specific file format. You can't just append two files together. One possibility may be to use javax.swing.text.rtf.RTFEditorKit to read the existing documents in, write some code to merge the two Document instances then use the RTFEditorKit to write the file back out.
[ August 12, 2005: Message edited by: Joe Ess ]
 
Ramya Thyagarajan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the response. I used the RTFEditorKit to read the rtf document from an input file and wrote the contents of the document into the output rtf file. The content of the files are appended but the formatting (The contents were tabulated as rows-columns in a grid) is lost. Is there an option to keep the formatting as is?

Thanks.
 
Karthikeyan Rajendraprasad
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you may find something helpful over here

Apache POI
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!