Hi,
We have an add-in to Microsoft Word that lets the user insert a “temporary” image. The doc file is then uploaded to our server and we want to replace the image with a new image using Aspose.Words.
In MS-Word, the image is initially being imported in to the document as a PNG file, and we “tag” it so we can find it later with the AlternativeText attribute. The final portion of the OpenXML document is below. The problem is, when we open this document with Aspose.Words, this section is imported as a DrawingML. I really don’t mind if that happens since during processesing we want to rip the entire section out and replace it with a new image. However, since it is being seen as a DrawingML and not a Shape, I don’t have access to the AlternativeText attribute (see desc=“grid31” below).
If it helps, we are using AddIn Express to do the insert with the following code:
Object oLinkToFile = false;
Object oSaveWithDocument = true;
Object oRange = selection.Range;
Word.InlineShape shape = selection.InlineShapes.AddPicture(globals.GetConfigPath()+ fn, ref oLinkToFile, ref oSaveWithDocument, ref oRange);
shape.AlternativeText = “grid” + GridID;
The section of the OpenXML that contains the image we are trying to find is at the bottom of this message.
Thanks for your help!
take care,
jasen
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0" xmlns:wp="<http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing>">
<wp:extent cx="2761905" cy="2685714" />
<wp:effectExtent l="0" t="0" r="635" b="635" />
<wp:docPr id="1" name="Picture 1" descr="grid31" />
<wp:cNvGraphicFramePr />
<a:graphic xmlns:a="<http://schemas.openxmlformats.org/drawingml/2006/main>">
<a:graphicData uri="<http://schemas.openxmlformats.org/drawingml/2006/picture>">
<pic:pic xmlns:pic="<http://schemas.openxmlformats.org/drawingml/2006/picture>">
<pic:nvPicPr>
<pic:cNvPr id="0" name="" />
<pic:cNvPicPr />
</pic:nvPicPr>
<pic:blipFill>
<a:blip xmlns:r="<http://schemas.openxmlformats.org/officeDocument/2006/relationships>" r:embed="rId4" />
<a:stretch>
<a:fillRect />
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0" />
<a:ext cx="2761905" cy="2685714" />
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst />
</a:prstGeom>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>