Hi
How can we read only images or visio diagrams from one doc file and paste these into another doc file.
Hi Saurabh,
Document doc2 = new Document();
foreach (Shape img in doc.GetChildNodes(NodeType.Shape, true))
{
Shape imported = (Shape)doc2.ImportNode(img, true);
doc2.FirstSection.Body.FirstParagraph.AppendChild(imported);
}
doc.Save(MyDir + @"16.6.0.docx");
Hi
Thanks for your reply.it works for me.
i need to know one thing that how can we read floating text which is written below image.
Hi
please find attachment file. i want “FIGURES 14 | SB_VIEW G_CAPTURE” and “TASK 2, SHEET 8: Group 1 - KIT - S46 FWD WAP-4 EQUIPMENT INSTL – 824J3460-1” text in image.or is there any method to copy whole content of page to another word docuement.
Document dstDoc = new Document(MyDir + "dstDoc.docx");
Document srcDoc = new Document(MyDir + "srcDoc.docx");
NodeImporter importer = new NodeImporter(srcDoc, dstDoc, ImportFormatMode.KeepSourceFormatting);
foreach (Paragraph node in srcDoc.GetChildNodes(NodeType.Paragraph, true))
{
Node importNode = importer.ImportNode(node, true);
dstDoc.FirstSection.Body.AppendChild(importNode);
}
dstDoc.Save(MyDir + "Out.docx");
Hi
Please find attachment file. i want 2 things in o/p file.
1. any page contains 2 images that will come same in output file page also.
2. orientation of page will be same like if source image is in portrait than page in o/p file will also be in
portrait.
Hi Saurabh,
Thanks for your inquiry. As per my understanding, you want to insert whole page of input document into another document with same page orientation. If this is the case, we suggest you following solution.
2) DocumentPageSplitter.GetDocumentOfPage(int page) returns the Document which contains the contents of specific page of input document.
3) Once you have Document of specific page, please use Document.AppendDocument method to append the specified document to the end of another document.
Please check “PageSplitter” example project in Aspose.Words for .NET examples repository at GitHub. Following code example shows how to extract a page of input document and insert it at the end of another document. Hope this helps you.
Document doc = new Document(MyDir + “input.docx”);<o:p></o:p>
LayoutCollector layoutCollector = new LayoutCollector(doc);
PageSplitterExample.DocumentPageSplitter splitter = new PageSplitterExample.DocumentPageSplitter(layoutCollector);
Document pageDoc = splitter.GetDocumentOfPage(1);
Document dstDoc = new Document(MyDir + "dstDoc.docx");
dstDoc.AppendDocument(pageDoc, ImportFormatMode.KeepSourceFormatting);
dstDoc.Save(MyDir + "Out v16.6.0.docx");