NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to write to a file including character attributes

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers
View previous topic :: View next topic  
Author Message
madroadbiker



Joined: 29 Apr 2012
Posts: 6

PostPosted: Sun May 06, 2012 7:36 pm    Post subject: How to write to a file including character attributes Reply with quote

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
emi



Joined: 14 Aug 2009
Posts: 154

PostPosted: Mon May 07, 2012 5:32 am    Post subject: Re: How to write to a file including character attributes Reply with quote

This is the wrong mailing list to ask such a question. nbdev@ is only used if you are developing the IDE/Platform itself. nbusers@ is for general questions.

That being said, the problem seems to be that you are using
Back to top
madroadbiker



Joined: 29 Apr 2012
Posts: 6

PostPosted: Wed May 09, 2012 11:32 pm    Post subject: Re: How to write to a file including character attributes Reply with quote

emi wrote:
This is the wrong mailing list to ask such a question. nbdev@ is only used if you are developing the IDE/Platform itself. nbusers@ is for general questions.

That being said, the problem seems to be that you are using


Sorry for posting in the wrong forum. I would move this thread if I could.
Anyway, where's the rest of your response? Sounds like it would help.
Back to top
emi



Joined: 14 Aug 2009
Posts: 154

PostPosted: Fri May 11, 2012 6:15 am    Post subject: Re: How to write to a file including character attributes Reply with quote

You email client has problems. Here's the online archive:
Back to top
madroadbiker



Joined: 29 Apr 2012
Posts: 6

PostPosted: Sat May 12, 2012 12:31 pm    Post subject: Re: How to write to a file including character attributes Reply with quote

emi wrote:
You email client has problems. Here's the online archive:


I don't know what's going on but again it looks like your message has been cut off. What archive? Why do you think my email client has problems? What does this have to do with my original question?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo