How to get Shape property wp:docPr id=“...” using .NET

Can I get below bold object id from the Aspose::Words::Drawing::Shape object?
The corresponding xml is like below:

<w:drawing>
	<wp:inline distT="0" distB="0" distL="0" distR="0" wp14:anchorId="2E6920ED" wp14:editId="3B41C14D">
		<wp:extent cx="3724275" cy="1885950"/>
		<wp:effectExtent l="0" t="0" r="9525" b="0"/>
		<wp:docPr id="5" name="Picture 5"/>
		<wp:cNvGraphicFramePr>
			<a:graphicFrameLocks noChangeAspect="1"/>
		</wp:cNvGraphicFramePr>
		<a:graphic>
			<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
				<pic:pic>
					<pic:nvPicPr>
						<pic:cNvPr id="5" name="Test.wmf"/>
						<pic:cNvPicPr/>
					</pic:nvPicPr>

@clarence.guo

Please note that Shape ID specifies a unique identifier for the current Shape object within the current document. This ID can be changed upon saving by Aspose.Words or MS Word (for example if you change document by adding new shape). So you cannot be sure that this ID is the same upon open/save.

In your case, we suggest you please use Shape.AlternativeText property to set the alternative text as Shape ID. Hope this helps you.

Thank you, @ tahir.manzoor. I only care this ID once in runtime, when I import the docx. Won’t care if this ID could be changed after saving.
My requirement is to get all NodeCollection of shapes when load a docx, then when acquire a request to convert an emf with specified id, then get the shape by searching this ID and convert it to PNG.
So alternative text cannot satisfy my requirement.
I found ShapeBase has a member get_Id, but it is protected so that I cannot call it from outside. And I’m not sure is get_Id method returning what I want, either whether there is such ability in Aspose.Words.

@clarence.guo

We have logged a new feature for your requirement as WORDSNET-21294. We will check the possibility of implementation of this feature and inform you via this forum thread once it is available.

Thank you @tahir.manzoor

@tahir.manzoor
I’m also interested in getting a shape given the docPr id. Is there any update on this?

@tcoutinho I have added your request to the feature request. We will keep you updated and let you know once it is resolved or we have more information for you.

Do you think it’s possible to give me an estimation of time for this feature to be released or for you to come back with more information?

@tcoutinho Currently, there is no estimate for this issue. I have asked the responsible development whether we can plan this issue for some specific release. We will get back to you once there are more information.

1 Like