Hi I am using the following code to access the shapes in my document.
The problem is if i have more than 1 shape in the document, although it shows the count as 2, it traverses the foreach loop only once.
Any suggestions to solve this problem will be really appreciated.
Document doc1 = new Document(dataDir + mailMergeTemplate);
NodeCollection shapes = doc1.GetChildNodes(NodeType.Shape, true);
int i = 0;
foreach (Shape shape in shapes)
if (shape.OleFormat != null)
// getting the name of the attachment from the Alternative text of the document
string ObjectName = shape.AlternativeText;
shape.OleFormat.Save(attchPath + ObjectName + shape.OleFormat.SuggestedExtension);
//Removes the embedded object from the document
// End of code snippet
doc1.Save(dataDir + mailMergeTemplate);
P.S. :- Also I can't find the name of my attachment in the world file. How can I retrieve the name of the attachment ?