Ask Your Question
0

Macro: Copy a textframe

asked 2015-03-18 18:51:21 +0100

markus_b gravatar image

I have a text document with a textframe. I want a macro who creates 11 clones of the textframe on the same page. The macro selects the frame, but when pasting it, the original frame gets overwritten. How can I programmatically deselect my selected frame, so that the paste operation creates a second copy ?

Here the code I have:

   frame = thisdoc.textframes.getbyIndex(0) ' select text frame
   controller.select(frame)
   dispatcher.executeDispatch(docframe1, ".uno:Copy", "", 0, Array())  ' copy it
   'here I need something to deselect the frame
   dispatcher.executeDispatch(docframe1, ".uno:Paste", "", 0, Array()) 'paste clipboard into it
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-03-19 14:28:06 +0100

pierre-yves samyn gravatar image

Hi - this should work:

dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())  
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-03-18 18:51:21 +0100

Seen: 187 times

Last updated: Mar 19 '15