So here’s the issue, I’m iterating thru a collection of paragraphs in a source document and when I locate certain verbage I note the starting Node. I then continue on searching for other verbage and note the ending Node. At this point I copy everything in between the two nodes to a destination document. Then I continue on searching the source document, and so on.
When I write the content found btwn the first Start / End node the destination looks fine, however performing this action again causes the second Start / End node to be placed almost on top of the first Start / End node.
Couple of things:
- I read in my Source like this:
Document srcDoc = new Aspose.Words.Document(....
- I create my destination like this:
Document dstDoc = srcDoc.Clone(); dstDoc.RemoveAllChildren(); dstDoc.EnsureMinimum(); dstDoc.FirstSection.Body.RemoveAllChildren();
- Here’s my importer and nodes to search:
NodeImporter importer = new NodeImporter(srcDoc, dstDoc, ImportFormatMode.UseDestinationStyles); NodeCollection MyNodes = srcDoc.GetChildNodes(NodeType.Paragraph, true);
- I grab the content as outlined here: https://forum.aspose.com/t/70413
I’ve even tried the following code to add some sort of buffer in btwn content inserts but it just gives lots of empty sections of large unwanted pages:
Section section = new Section(dstDoc); dstDoc.AppendChild(section); Body body = new Body(dstDoc); section.AppendChild(body); Paragraph p1 = new Paragraph(dstDoc); dstDoc.LastSection.Body.AppendChild(p1); body.AppendChild(p1);
Anyone have some thoughts?
Thanks - Dave