I need to retrieve the Visio drawing from DOC file (not image). DOC file: Test.zip (100.2 KB)
This Topic is created by imran.rafique using the Email to Topic plugin.
I need to retrieve the Visio drawing from DOC file (not image). DOC file: Test.zip (100.2 KB)
This Topic is created by imran.rafique using the Email to Topic plugin.
Thanks for your inquiry. Please use the following code example to extract the Visio drawing from document. Hope this helps you.
Document doc = new Document(MyDir + @"Test.doc");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
if (shape.OleFormat != null && shape.OleFormat.ProgId == "shape.OleFormat.ProgId")
{
shape.OleFormat.Save(MyDir + "oleVisio" + shape.OleFormat.SuggestedExtension);
}
Thanks for your support. I have to replace the extracted image in the same document.
Could you please suggest?
thanks in advance
John
Thanks for your inquiry. If you want to replace OLE object with another OLE, please move the cursor to the Shape node and insert the OLE using DocumentBuilder.InsertOleObject method. After inserting the OLE, please remove the Shape node.
Hope this answers your query. If you still face problem, please share some more detail about your query along with input and expected output documents. We will then provide you more information about your query.
Thanks for your support. Could you give sample for replace OLE object with another OLE in same document.
Thanks
Thanks for your inquiry. Please use the following code example to move the cursor to the OLE object and insert the OLE.
Document doc = new Document(MyDir + "input.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
if (shape.OleFormat != null && shape.OleFormat.ProgId == "shape.OleFormat.ProgId")
{
builder.MoveTo(shape);
builder.InsertOleObject(MyDir + "oleVisio.vsd", "Visio.Drawing.11", false, false, null);
shape.Remove();
}
doc.Save(MyDir + "18.3.docx");