View Single Post
  #1  
Old 14-04-2010, 07:09
basti.schneider
Guest
 
Posts: n/a
Default Copying Shapes from one File to another

Hello,

does anyone know a trick how to reliably copy shapes from one file to another?

I have a few methods but none is perfect.


Method 1: Copy & Paste
===============

Shape.copy
TargetLayer.paste

Problems: it's not as fast as one could hope as the shape is added to the clipboard in several formats (I think).
And the resulting files are sometimes corrupted. The clipboard doesn't seem to be too reliable (at least in X3).


Method 2: Virtual Shapes
================
dim tn as TreeNode
set tn = QuellShape.TreeNode.GetCopy
tn.UnLink
tn.LinkAsChildOf(TargetLayer.TreeNode)
TargetLayer.Page.Parent.Parent.LogCreateShape(tn.VirtualShape)

Advantage: fast
Disadvantage: not reliable. The resulting files are often corrupted and can't be opened after they are saved.
And the ObjectDatas of the shapes get lost.


Method 3: Exporting an importing
=====================

SourceShape.CreateSelection;
ActiveDocument.SaveAs(TempFilename, cdrCurrentVersion, cdrSelection)
ImportFileToLayer(TargetLayer, TempFilename)

Advantage: the only reliable method I know.
Disadvantage: sloooow


Method 4: CopyToLayer
===============

sh.CopyToLayer TargetLayer

Problem: this doesn't work.
Error: "The layer object doesn't belong to this document."



Does anyone know another method to copy shapes from one document to another document?

Are there any new methods in X4 or X5 that make it possible to move shapes from one document to another document?

Any suggestions would be greatly appreciated!

Thanks,

Basti
Reply With Quote