We are trying to insert a srcDoc in a dstDoc.
Actually we have a pdf document. We have converted this pdf doc to docx document using aspose pdf.
We are considering this converted docx doc as dstDoc.
We are now trying to insert a srcDoc(docx) after a paragraph node in dstDoc.
We have tried multiple approaches and observed that the src doc is printing at the top of the page.
We have iterated the document object at node level and used importNode method insertAfter methods for inserting srcDoc after a paragraph in dstDoc.
This inserts the data from dstDoc to srcDoc. But the inserted value can be seen at the top of the page.
Please let us know the way to achieve document insertion at a paragraph node or replacing pargraph with document.
Please access the link Joining and Appending Documents for details on how two or more Word documents can be joined together. Try the solution from the link at your end and update us with your results.
We have followed the same link.
We have the following document.
Screen Shot 2018-07-06 at 1.27.09 PM.png (31.9 KB)
In this document, we want to insert another document in place of text ‘@@…@@’
When we are trying to insert, the document is getting inserted at the top of the page
result.png (55.9 KB)
We want the inserted content to be displayed below text ‘@@…@@’
You can try the DocumentBuilder.InsertDocument method. Hope, this helps.
Document docA = new Document("D:\\temp\\A.docx");
Document docB = new Document("D:\\temp\\B.docx");
DocumentBuilder builder = new DocumentBuilder(docA);
We are looking to insert document at some identifier in the document… this identifier may exist at any place in the document.
builder.MoveToDocumentEnd(); this might be moving to end of document.
Yes, DocumentBuilder.MoveToDocumentEnd method will move the cursor to the end of the document. The DocumentBuilder class has an internal cursor that you can navigate to a different location in a document using various DocumentBuilder.MoveToXXX methods such as DocumentBuilder.MoveToDocumentStart and DocumentBuilder.MoveToField.