Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy am I getting an illegal value error using PpShapeFormat in Office 2013 Interop
    primarykey
    data
    text
    <p>I wrote an MS JScript utility (for use in SmartBear's TestComplete) that exports images that are embedded in a Word document to PNG files on disk. When I run this utility on Win7, with Office 2010, everything works fine. But when I run it on Win8 with Office 2013, I get an "illegal value" error when passing the PpShapeFormat filter to the Export method. </p> <p>Here's the relevant portion of my script:</p> <pre><code>//get the list of shapes from the word doc, and how many there are var iShapeList = DocObj.InlineShapes; //DocObj is created elsewhere var iShapeTotal = iShapeList.count; //create a powerpoint object and instantiate a presentation var pptApp = Sys.OleObject("PowerPoint.Application"); //open PowerPoint var pptDoc = pptApp.Presentations.Add(); //create a new blank document var pptDocSlide = pptDoc.Slides.Add(1, 12); //12 = ppLayoutBlank var pptShapeFmt = pptApp.PpShapeFormat; //format filter object //loop through the Word document shapes, copy each one, paste it to the Ppt slide, //export the image out of the slide, and then delete it for(var iShapeNo = 1; iShapeNo &lt;= iShapeTotal; iShapeNo++) { var iShape = iShapeList(iShapeNo); //get a shape iShape.ScaleHeight = hScale; //set the shape height and width iShape.ScaleWidth = wScale; iShape.Range.Copy();//copy the shape to the clipboard try { with (pptDocSlide.Shapes.Paste(1)) //PpViewType 1 = Paste into Slide View { //Export the image pasted into the slide, to the extract path, then delete the slide. Export(ExtractPath + "\\" + IntToStr(iShapeNo) + ".png", pptShapeFmt); //2 = ppShapeFormatPNG Delete(); ++successTally; //one more in the WIN column! } } catch(exception) { //does a bunch of cleanup } } </code></pre> <p>Researching the PpShapeFormat, I found this <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.ppshapeformat%28v=office.14%29.aspx" rel="nofollow">Enumeration</a> reference. But I'm having trouble finding any doc on changes between 2010 and 2013, and no good examples of how to use it properly. </p> <p>Does anyone have any idea what's going on here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload