Hi Markus, 

you might want to look at the TextPortion service:

http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextPortion.html

TextPortions are parts of text with homogenous properties. If you iterate over 
the textportions of a paragraph, you essentially get a collection of string 
with formatting properties. 

The intersting part of the developers guide is

http://api.openoffice.org/docs/DevelopersGuide/Text/Text.htm#1+3+1+2+Iterating+over+Text

Cheers,

Peter

-----Urspr�ngliche Nachricht-----
Von: Markus Plessing [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 6. April 2005 15:47
An: [email protected]
Betreff: [api-dev] read back Text and determine format


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,


currently I'm working on an Java application creating documents in OOo. The 
user can enter text into an JTextPane and format the text e.g. bold. I parse 
out the text and get a simple string with format marks like "[b]Text[/b]" Now I 
insert the text with the given format into a TextSection of my OOo-document 
with code like this:

mxDocCursor.gotoStart( false );
XPropertySet mxDocCursorProps = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, mxDocCursor ); 
mxDocCursorProps.setPropertyValue("CharWeight", new
Float(FontWeight.BOLD));
mxDocText.insertString ( mxDocCursor, "This is a Text for testing purposes", 
false );

This works very well, but now I'm facing the problem that I have to read the 
text back out of some sections _with_ my formattings and maybe additional 
formatting set within OOo.

Is there a possibility to get the text within something like a char-array and 
check the Properties of each char to determine if it is formatted e.g. bold or 
something else?

Any hints or other suggestions?

Many thanks,

Markus

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCU+g1aXgUt+wiTuERAmu0AJ9/wLsOd6GTO8G1VAEgB8ol9YPhogCfZLQ0
uZd/XQhgYQ/UUHYfr3tRvrI=
=TUA4
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to