Document blockDocument = new Document(args.Replacement);
DocumentBuilder templateDocumentBuilder = new DocumentBuilder(_baseDocument);
templateDocumentBuilder.MoveTo(args.MatchNode);
NodeImporter importer =
new NodeImporter(blockDocument, _baseDocument, ImportFormatMode.KeepSourceFormatting);
foreach (Aspose.Words.Section srcSection in blockDocument.Sections.OfType<Aspose.Words.Section>())
{
AsposeSection s = importer.ImportNode(srcSection, true) as AsposeSection;
templateDocumentBuilder.CurrentSection.PageSetup.Orientation = srcSection.PageSetup.Orientation;
templateDocumentBuilder.CurrentSection.AppendContent(s);
templateDocumentBuilder.MoveTo(templateDocumentBuilder.CurrentSection.Body.LastChild);
templateDocumentBuilder.InsertBreak(BreakType.SectionBreakNewPage);
}
Node matchedBlockCodeParagraph = args.MatchNode.ParentNode;
matchedBlockCodeParagraph.Remove();
I have 2 documents, i want to insert all sections from 1 document to another at a specific location (args.MatchNode is the location after which i want all the sections to get inserted). How do i achieve this?