Hi,
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.
-Sunil
==========================================
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);
srcDoc.getFirstSection().getPageSetup().setSectionStart(SectionStart.CONTINUOUS);
Bookmarks bk = dstDoc.getRange().getBookmarks();
FormField field = dstDoc.getRange().getFormFields().get(0);
Node endNode = getFormFieldEndNode(field,bk);
builder.moveTo(endNode);
dstDoc.getRange().getFormFields().remove(field);
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;
while(secIt.hasNext())
{
Section srcSection = (Section)secIt.next();
Body secBody = srcSection.getBody();
Iterator it = secBody.iterator();
while(it.hasNext())
{
Node n = (Node)it.next();
Node dstSection = dstDoc.importNode(n, true, ImportFormatMode.KEEP_SOURCE_FORMATTING);
bNode.insertAfter(dstSection,insertAfterNode);
insertAfterNode = dstSection;
}
}
builder.endBookmark("123");
dstDoc.save("C:/data/out.doc");
}