Hi guys
When inserting a sub document, we found a problem that the number of the list was reset, as shown in the figure below. The starting value in the source document was 2, and it was reset to 1 after reaching the target document. The code and attachments below are the corresponding documents.
The version of aspose.word is 202012
image.png (12.0 KB)
image.png (17.8 KB)
bellow are the code and enclosed files :
dest.docx (13.1 KB)
listnumber.docx (513.6 KB)
Document dest = new Document("d:\\dest.docx");
Document list = new Document("d:\\listnumber.docx");
Node last = dest.LastSection.Body.LastParagraph;
if (list != null)
{
foreach (Section s in list.Sections)
{
foreach (Node node in s.Body.ChildNodes)
{
try
{
Node newNode = dest.ImportNode(node, true, ImportFormatMode.KeepSourceFormatting);
last.ParentNode.InsertAfter(newNode, last);
last = newNode;
}
catch (Exception ex)
{
}
}
}
}
dest.Save("d:\\merged.docx", SaveFormat.Docx);