Attached is a word document with only one image. The image is clipped. I found that the image is represented by a DrawingML object. The “ImageData” property of the object is the whole image data, but not the image clipped. Besides the width and the height of the image, I have not found any properties which represent the clip information ( the top and the left distance of the clipped image to the original whole one). How can I get the clip information of that image?
Thanks for your inquiry. You can use the following code to achieve this:
Document doc = new Document(MyDir + @“clip.docx”);
DrawingML dml = (DrawingML)doc.SelectNodes("//DrawingML");
// to get the cropped DrawingML
dml.GetShapeRenderer().Save(MyDir + “outCropped.png”, new ImageSaveOptions(SaveFormat.Png));
I hope, this helps.