We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Custom image not being recognized by shape.name of shape.shapetype

Hi,

I recently upgraded from Aspose.word version8 to 10. I am now having a problem the name and then was able to move it. Now I cannot find it ny name or type. This all worked fine before. Below is the code snippet.

Dim shapes As NodeCollection = doc.GetChildNodes(NodeType.Shape, True)

For Each shape As Shape In shapes

If shape.Name = "XM_markup_sm.png" Then

shape.Left = 'Some Number'

j = j + 1

End If

Next

I am attaching the doucument as well.

Hi Bernie,


Thanks for your inquiry.

In the latest verison of Aspose.Words, DrawingML objects are now loaded into a DrawingML class instead of a Shape class. This is the reason why you can't find the image by interating through the shapes inusing your current code.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I'm afraid, the current version of Aspose.Words the DrawingML class does not yet provide many public methods to interface with the object's properties that can be used with a traditional Shape object. There is no way to find the name of a DrawingML object yet. However this hopefully will be supported within the next release or the one after it. We will inform you of any developments.

In the mean time you can still work around this issue by first saving the document to DOC format in memory. Please see the code below.

Document doc = new Document("youDoc.docx");

// Convert DOCX to DOC to get access to images.

MemoryStream docStream = new MemoryStream();

doc.Save(docStream, SaveFormat.Doc);

doc = new Document(docStream);

// Get all shapes in the document.

NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);

// Loop through all shapes.

foreach (Shape shape in shapes)

{

// Working with shape

}

If we can help you with anything else, please feel free to ask.

Thanks,

The issues you have found earlier (filed as WORDSNET-4824) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(12)