Free Support Forum - aspose.com

Insert document to Parent document removes bullet listing

Hi Team,

I got 1 issue while inserting document into main document. The document that I am inserting(source document) has Bullet listing but when I insert that document into main document then we loose bullet listing.

I am using below code for inserting document.

builder.insertDocument(sectionDocument, ImportFormatMode.KEEP_SOURCE_FORMATTING);

builder -> is main document builder.
sectionDocument -> the document that I am inserting has bullet list.

Please see attached documents for your reference.

Bullet Listing Not Displayed.zip (59.7 KB)

@diwanmail,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for Java 18.6 with following code example. We have not found any issue with bullet list. Please check the attached output document. 18.6-Java.zip (26.6 KB)

Document doc = new Document(MyDir + "Main Destination Document.docx");
Document subDoc = new Document(MyDir + "Source Doument with Bullet.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveToDocumentEnd();
builder.insertDocument(subDoc, ImportFormatMode.USE_DESTINATION_STYLES); 

doc.save(MyDir + "18.6-Java.docx");

Please note that Aspose.Words mimics the behavior of MS Word. If you perform the same scenario using MS Word, you will get the same output.

Hi Tahir,

It worked for me too , the only difference in my code is ImportFormatMode. I was using “KEEP_SOURCE_FORMATTING”. and you used “USE_DESTINATION_STYLES”.

One thing, I would like to know, does “USE_DESTINATION_STYLES” maintains Source document formatting.

One other thing, why it was not working with “KEEP_SOURCE_FORMATTING”??

Thanks,
Vaibhav Diwan

@diwanmail,

Thanks for your inquiry.

Please refer to the following article.
Differences between ImportFormat Modes

We have not found this issue while using latest version of Aspose.Words for Java 18.6. Please use Aspose.Words for Java 18.6.