Hi all ,

I had created a Document using jTextPane which I will use as a Template to create customize ones .

For eg :
I will create something like this in a Document using jTextPane

Hi <name>

and I will open this Document in another jTextPane to replace <name> with a user input word(say John) using inserString method of StyledDocument .

Everything is fine expect that I lost format of that (<name>) which I set in previously created Document .That is it's font attributes (bold ,italic ,underline style) are all changed to plain .

This is what I getting :

Hi John

and this is what I'm expecting :

Hi John.

Can any one tell me how to do that . That is replacing the word with out losing styles ?

Thanks in advance

Recommended Answers

All 2 Replies

Ezzaral ,thanks a lot for pointed out a useful link for my reference. It really helped.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.