Issue with Bullets and numbering feature with Aspose Word for Java

Recently I have upgraded to Aspose2.0.2 and noticed that it doesn’t merge document correctly, if in case document contains auto numbers.
All auto numbers are converted to 1. in merged document.
This functionality use to work with previous versions
Please look at attched document for example.
I am also attaching the code which I used to merge documents.



static void testMergeDocuments() throws Exception
    Document dstDoc = new Document("C:/data/dst.doc");
    Document srcDoc = new Document("C:/data/src.doc");

    DocumentBuilder builder = new DocumentBuilder(dstDoc);

    Bookmarks bk = dstDoc.getRange().getBookmarks();
    FormField field = dstDoc.getRange().getFormFields().get(0);
    Node endNode = getFormFieldEndNode(field,bk);
    BookmarkStart start = builder.startBookmark("123");
    Paragraph pNode = (Paragraph)start.getParentNode();
    Body bNode = (Body)pNode.getParentNode();

    Sections sec = srcDoc.getSections();
    Iterator secIt = sec.iterator();
    Node insertAfterNode = pNode;
        Section srcSection = (Section);
        Body secBody = srcSection.getBody();

        Iterator it = secBody.iterator();
            Node n = (Node);
            Node dstSection = dstDoc.importNode(n, true, ImportFormatMode.KEEP_SOURCE_FORMATTING);
            insertAfterNode = dstSection;


Could you please attach the original documents as well to enable us reproduce the issue?

Please find the attached zip file.
src.doc and dst.doc are two file which are getting merged to generated out.doc


Unfortunately, we are still unable to run your code because the getFormFieldEndNode method is missed. Could you please post all your code necessary for replication?

We’ve commented it and are looking into the issue. However, if the missed code does make sense, please post it here nevertheless.

Hi, Sunil,
You should use NodeImporter to correctly import styles and list formatting as well. The thing is that word stores styles and list formatting centrally, separately from the text itself. And NodeImporter helps to import styles and formatting together with the text referencing its.

 Document srcDoc = new Document("C:/data/src.doc");
 Document dstDoc = new Document("C:/data/dst.doc");
 //The NodeImporter imports (when needed) styles and list formatting that linked
 //to a text of a source document but stored centrally, separately from the text itself.
 NodeImporter importer = new NodeImporter(srcDoc, dstDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
 Section srcSection = srcDoc.getSections().get(0);
 Section dstSection = (Section)importer.importNode(srcSection, true);

Best Regards,

Thanks for the quick response.
With NodeImporter it works perfectly.