P2000
P2000

Reputation: 101

Can't we copy shape(s) from a PPT slide to word document in the orginal format in C#?

I tried to copy autoshape from PPT to word. but its copying as picture format. We cant edit the text or shape in word. How to avoid this?

Code I m using not giving expected esult:

foreach (Microsoft.Office.Interop.PowerPoint.Shape shape in slide.Shapes)
{
   if (targetDoc != null)
   {
      shape.Copy();
      this.wordApp.ActiveWindow.Selection.Paste();
   }
 }

Upvotes: 2

Views: 3236

Answers (3)

P2000
P2000

Reputation: 101

somewhat i manged to copy shape in EMF format.

shape.Copy(); 

object objectMissing = System.Reflection.Missing.Value;                                                                             
object objLink = false;
object objType = WdPasteDataType.wdPasteEnhancedMetafile;                                        
wordApp.ActiveWindow.Selection.Range.PasteSpecial(ref objectMissing, ref objLink, ref objectMissing, ref objectMissing, ref objType, ref objectMissing, ref objectMissing);

Upvotes: 2

sehe
sehe

Reputation: 392921

Obviously, Copy is not the right API

CopySepcial might be what you need (though you'll have to look at docs yourself)

I suggest recording a macro in Word, while you insert a single simple shape. Inspect the code generated in the macro and mirror that for building up the shapes as shapes in the target document.

Upvotes: 0

maxi3601
maxi3601

Reputation: 96

This may be a default thing in the Office.Interop library which cannot be changed.

Upvotes: 0

Related Questions