Empty Table of Contents


I have found a problem with tables of contents.

Steps to Reproduce:
Data: toc.zip (35.1 KB)

  • document contains toc with custom levels and one headline with the corresponding style (ToC1), see test.docx.
  • TOC \h \z \t “ToC1;1”


  1. doucment is loaded
  2. fields are updated
  3. document is saved

Document document = new Document(“test.docx”);

System1 - Microsoft Windows Server 2016 Datacenter - without Microsoft Word installed
System2 - Microsoft Windows 10 Pro - Microsoft Word 2013 installed

Aspose version:
tested with Aspose.Words for Java version 18.7 and 20.8

I get different results depending on the system. The result of System2 is correct, see result_local.docx. The result of System1 is not correct, see result_server.docx. The toc is empty and the following message is displayed: “No table of contents entries found”. In addition, both paragraphs have been merged.
It is probably not easy to reproduce the error. If you need more information, e.g. about the systems, please ask.

Best regards


Please note that Aspose.Words mimics the behavior of MS Word. If you perform the same scenario using MS Word under English culture, you will get the same output. Please execute the code under German culture as shown below to get the desired output.

Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); 
Document doc = new Document(MyDir + "result_server.docx");
doc.Save(MyDir + "out.docx");

Hello @tahir.manzoor

thanks for the quick reply.
I was able to reproduce the behavior and can now solve my problem.
I have found no information on this behaviour. Is this a bug in Word or is it a feature? You may be able to provide some information so I can understand the behavior.
Thanks a lot for your support.

Best regards

The cause of the behavior results from the localization and representation of the separators for lists.
There are several entries in Microsoft Forums:

Depending on the language, the separator of the toc is set as comma or semicolon:
en-US: { TOC \h \z \t “ToC1,1,ToC2,2” }
de-DE: { TOC \h \z \t “ToC1;1;ToC2;2” }

If the toc is updated with the wrong locale, the toc cannot be processed correctly.

Best regards


This is the expected behavior of MS Word and Aspose.Words. It is not a bug.

Moreover, the problem you are facing due to the Culture difference. Under “de-DE” the list separator is ; (semi colon) not , (comma). Please change the separator to comma and update the field under English culture, you will get the TOC items.