Hi list,

I 'm looping through a document, and I want to "merge" some
paragraphs, ie past the contents of a paragraph in anothor. I want to
keep the markup (italic, bold etc).
I think I got the right methods, yet I get
a "unknown text content" exception.  This seems to be a recurring problem

(see eg.
http://www.oooforum.org/forum/viewtopic.phtml?t=51317&highlight=
)


My code looks like this

while ( xParaEnum.hasMoreElements() )
       {
        
com.sun.star.uno.Any currElement = (Any) xParaEnum.nextElement();

XTextContent paragraph = (XTextContent)
UnoRuntime.queryInterface(XTextContent.class, currElement);

...

                        
//This WORKS, but layout is lost
//mxDocText.insertString( previousText.getAnchor().getEnd(),
//   paragraph.getAnchor().getString() , false );

//This gives execpton
mxDocText.insertTextContent ( previousText.getAnchor().getEnd(),
paragraph, false);



Exception:

com.sun.star.lang.IllegalArgumentException: unknown text content
        at 
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:275)
        at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:141)
        at 
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:377)
        at 
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:346)
        at 
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:106)
        at 
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:860)
        at 
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:809)
        at 
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:159)
        at 
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:141)
        at $Proxy7.insertTextContent(Unknown Source)
        

any clues, alternatives ?

thx !

Dominique

FYI: my enumerator is initialized like in the examples:

       XTextDocument mxDoc = (XTextDocument)UnoRuntime.queryInterface(
           XTextDocument.class, source);

       // get a reference to the body text of the document
       XText mxDocText = mxDoc.getText();


       // Here, we access this interface
       XEnumerationAccess xParaAccess = (XEnumerationAccess)
           UnoRuntime.queryInterface(XEnumerationAccess.class, mxDocText );
       // Call the XEnumerationAccess's only method to access the actual
       // Enumeration
       XEnumeration xParaEnum = xParaAccess.createEnumeration();

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

Reply via email to