Saving Textsection to new document
Posted: Fri Jan 31, 2014 5:12 pm
Hi,
as the title suggests, I try to save a textsection with all his formated text to a new document.
I've got a couple of textsections in my document and some of them are visible, some are not.
The only solution I found until now, is to use copy and paste with the viewcursor. Like this:
When I do it this way, I have to make every section visible. But I want my code to run in the background, so that the user won't see all of the action, which is going on.
I also tried another way: creating a new section in the new document and attach the old section to it. But it didn't work. The code is roughly like this:
The documentation says: "Some implementations may only accept contents which were created by the factory that supplied the same text or the document which contains the text"
http://www.openoffice.org/api/docs/comm ... XText.html
That might be the reason.
Does anyone know a better way to save a textsection to a new document?
Thanks for help,
ponc
as the title suggests, I try to save a textsection with all his formated text to a new document.
I've got a couple of textsections in my document and some of them are visible, some are not.
The only solution I found until now, is to use copy and paste with the viewcursor. Like this:
Code: Select all
Copy and Paste
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(doc1.CurrentController.Frame,".uno:Copy","",0,())
dispatcher.executeDispatch(doc2.CurrentController.Frame ,".uno:Paste","",0,()) I also tried another way: creating a new section in the new document and attach the old section to it. But it didn't work. The code is roughly like this:
Code: Select all
newSection = self.doc.createInstance("com.sun.star.text.TextSection")
new_text.insertTextContent(newTextSectionCursor, oldSection.Anchor, False)http://www.openoffice.org/api/docs/comm ... XText.html
That might be the reason.
Does anyone know a better way to save a textsection to a new document?
Thanks for help,
ponc