We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Formatting changed while updating Auto TOC fields in the document

Hi,


I am using Aspose 16.12 api’s to update Toc fields in a document . It seems like the formatting is different from the formatting we obtain while updating a TOC field in Microsoft Word.

Paragraph spacing between the headings in AutoToc(while updated through Aspose Api’s) is more than the paragraph spacing between the headings when updated through Microsoft Word.

Also, it is showing different behaviour when we merge the document.
For eg. Doc1 conatins headings with heading style 1 with AutoToc,
Doc 2 conatins headings with heading style 2
Merging docl and doc2 and then updating the TOc field give different paragraph spacing.
Between headings of Heading Style1 : 5pt (After)
Between headings of heading style2 : 8pt (After)

Whereas when updated through Microsoft word paragraph spacing is always : 5pt, irrespective of the heading style.

Here is the sample code I used.
doc1 = new Document(getFilePath(folder, file1));
doc2 = new Document(getFilePath(folder, file2));
doc2.getFirstSection().getPageSetup().setSectionStart(SectionStart.CONTINUOUS);
doc1.appendDocument(doc2, ImportFormatMode.KEEP_SOURCE_FORMATTING);
doc1.updateFields();

Whereas if I just update the field in document using aspose Api’s it gives paragraph spacing : 8pt(After) irrespective of styles.

Sample code:
doc_withoutMerge = new Document(getFilePath(folder, file1));
doc_withoutMerge.updateFields();

I am attaching the documents:
doc1 : document 1 with heading style 1
doc2 : docuemnt 2 with heading style 2
merged_update : merged document (doc1 + doc2) with updated AutoToc using aspose api.
Microsoft_word_doc : updated field by microsoft word.

doc_withoutMerge: document with heading style 1 and heading style 2
Aspose_updated: docuement updated AutoToc using aspose api
Microsoft_word_doc : updated field by microsoft word.

Can you please suggest a possible solution for this problem.

Thanks
Shubhangi




Hi Shubhangi,


Thanks for your inquiry. We have tested the scenario and noticed the reported TOC paragraph spacing issue, so logged a ticket WORDSNET-15147 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,