ListLabel numbering and KeepSourceFormatting issues when importing paragraph nodes

Hi Team,

I’ve picked up a bug when using the NodeImporter to import paragraph nodes from one document into another. As of version 17.6, the ListLabel numbering on the paragraphs of the imported document do not start at 1. It also looks like the source document styles are not being imported correctly when using ImportFormatMode.KeepSourceFormatting.

I’ve tested on the latest version (v19.9) and I’m getting the same results.

Attached is a solution with some unit tests exercising this functionality across different Aspose.Words versions.

Hope you guys can assist with this issue, Thanks!
AsposeTest.zip (104.7 KB)

@ErnestK,

We are working over your query and will get back to you soon.

@ErnestK,

Inside your ImportDocument(Document destinationDoc, Document sourceDoc, ImportFormatMode importFormatMode) method, can you please add the following code and see if it resolves the issue with list numbering on your end?

ImportFormatOptions opts = new ImportFormatOptions();
opts.KeepSourceNumbering = true;

NodeImporter nodeImporter = new NodeImporter(sourceDoc, destinationDoc, importFormatMode, opts);
bool importChildren = true;

foreach (Node sourceNode in sourceDoc.FirstSection.Body)
{
    Node destinationNode = nodeImporter.ImportNode(sourceNode, importChildren);
    destinationDoc.FirstSection.Body.AppendChild(destinationNode);
}