NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
madroadbiker
Joined: 29 Apr 2012 Posts: 6
|
Posted: Sat May 12, 2012 12:39 pm Post subject: How to write to a file including character attributes |
|
|
This was originally posted to the wrong forum so I am posting it where I was told to instead.
I have an application which has two text panes. The user can enter text into the text panes with attributes like underline, bold, italics, subscript, and superscript and it all looks fine in the text panes. I enable the user to save the contents of the text pane into a file in either plain text, pdf, or xml. I am using iText for the pdf output and java.beans XMLEncoder for xml output. Neither format saves the character attributes. They both save in plain text.
Here is how I am trying to save in xml format (contentWindow is a textPane):
| Code: |
XMLEncoder encoder =
new XMLEncoder(
new BufferedOutputStream(
new FileOutputStream(fileName)));
encoder.writeObject(contentWindow.getText());
encoder.close();
|
What am I doing wrong? |
|
| Back to top |
|
 |
madroadbiker
Joined: 29 Apr 2012 Posts: 6
|
Posted: Mon May 21, 2012 3:48 pm Post subject: |
|
|
| Can someone please help with this? Either with the xml output or pdf. I can not figure out how to output what is displayed in my text panes including the character attributes to either an xml or pdf file. A detailed example would be nice. Thanks. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|