• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Append two rtf files into one rtf document using io stream

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you may find something helpful over here

Apache POI
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic