You can programmatically copy shapes on one page of a document and paste them into a new page in the same document. You can choose to paste them into the default location (the center of the active window) or into the same coordinate locations as they had on the original page.
Nov 16, 2013 The easiest way to copy and paste shapes would be to duplicate the shape layer in the layers panel. That way the shapes will be independent copies. To do this, first make a rectangle that you'd like to copy. Then, with your rectangle selected, click the panel menu icon in. We can create script by right clicking on the each job and save it in a file and execute on your destination server. You can use SSIS (Transfer Jobs Task) to export all jobs.
Copy and paste shapes
For details about the object model, see the VBA reference documentation for the Microsoft.Office.Interop.Visio.Shape.DrawRectangle, Microsoft.Office.Interop.Visio.Shape.DrawOval, Microsoft.Office.Interop.Visio.Shape.Copy, and Microsoft.Office.Interop.Visio.Shape.Paste methods and the Microsoft.Office.Interop.Visio.VisCutCopyPasteCodes.visCopyPasteNormal flag.
To copy shapes to the center of another page
The following example demonstrates how to copy the shapes from the first page and paste them into the center of the second page.
Copy and paste shapes with the same positions
For details about the object model, see the VBA reference documentation for the Microsoft.Office.Interop.Visio.Shape.DrawRectangle, Microsoft.Office.Interop.Visio.Shape.DrawOval, Microsoft.Office.Interop.Visio.Shape.Copy, and Microsoft.Office.Interop.Visio.Shape.Paste methods and the Microsoft.Office.Interop.Visio.VisCutCopyPasteCodes.visCopyPasteNoTranslate flag.
If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Office Word document), use the PasteSpecial method.
To copy shapes and shape locations to another page
The following example demonstrates how to copy the shapes from the first page and paste them into the second page with their original coordinate locations.
See also
I have seen many answers out here and there that suggest to use the Copy()
and Paste()
methods for copying shapes between slides, presentations and applications:
These methods work fine but have side effects because they interact with the clipboard without user consent. When a program runs a series of copy-paste operations in background, it is impossible for a user to work with the clipboard.
I have been looking for a possibility to backup and restore the clipboard, but it looks like it is a wrong way (seetheseanswers). Another reason for not using the clipboard for copying is that if a user copies something into clipboard just before we call Paste()
we will end up with a wrong result.
Is there a sane way?
1 Answer
You could conceivably use the .Export method on the shape to export it as, say, EMF, then insert it as a picture into the target slide. That won't give you the same result as copy/pasting the shape, though.
I wouldn't worry all that much about the user copying something in between your programmatic copy/paste. Even if PPT were to allow that (which I'm not sure it would) your copy/paste operation would be almost instantaneous.
That still leaves the problem of not deleting whatever else the user might have put on the clipboard. Office maintains its own clipboard independent of the Windows system clipboard, but other than one comment, I couldn't find anything on how you could programmatically control it. And that one comment, from a source I trust, said that you can't, at least not in Office versions later than 2000. But it's something you might want to look further into.