Apache OpenOffice (AOO) Bugzilla – Issue 23680
duplicate tables
Last modified: 2013-02-24 21:07:00 UTC
Hi, I'm trying to duplicate a textTable in a textDocument or insert into an empty one. I'm doing the following: String loadUrl = "private:factory/swriter"; Object desktop = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xRemoteContext); XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, desktop); PropertyValue[] loadProps = new PropertyValue[0]; XComponent blanco = xComponentLoader.loadComponentFromURL(loadUrl, "_blank", 0, loadProps); XTextDocument td = (XTextDocument)UnoRuntime.queryInterface (XTextDocument.class, blanco); XText text = td.getText(); XTextRange xtr = (XTextRange)UnoRuntime.queryInterface (XTextRange.class,text.getStart()); XTextContent tc = (XTextContent)UnoRuntime.queryInterface(XTextContent.class, xIndexedTables.getByIndex(1)); text.insertTextContent(xtr, tc, false); The conexion is allright and I'm sure that the load and store documents work. I've tried in differents ways and always get the same Exception: om.sun.star.uno.RuntimeException: SwXTextTable: already attached to range. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readThrowable (Unmarshal.java:315) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readAny (Unmarshal.java:157) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readObject (Unmarshal.java:404) at com.sun.star.lib.uno.protocols.urp.urp.readReply(urp.java:192) at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:308) at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:607) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.in voke(java_remote_bridge.java:182) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.ru n(java_remote_bridge.java:173) Why I get this if my document is empty??
forwarding to responsible developer
Since the table is already inserted in the document you cannot call insertTextContent for that table thus the "SwXTextTable: already attached to range." exception. You can only attach / insert tables that are currenlty only a descriptor i.e. the table was created via API but not yet inserted in the document. That is you can not insert the same table twice. The only way to copy a table is to select the table with the view cursor (e.g. by selecting all cells) and use cut-copy and paste as macro call (UNO dispatches). You can see how this works by using the mcro recorder and having a look at the generated macro.
Set to invalid.
The Patch you submitted has been marked as 'Resolved' and not updated within the last 2 years+. I am therefore setting this issue to 'Verified' as the first step towards Closing it. If you feel this is incorrect, please re-open the issue and add any comments. Many thanks, Andrew Cleaning-up and Closing old Issues as part of: ~ The Grand Bug Squash, pre v3 ~ http://marketing.openoffice.org/3.0/announcementbeta.html
As per previous comment: Verified > Closed. Regards, Andrew