Behavior different from updating the TOC between Windows 7 and Windows server 2008


I have a problem when I try to update the TOC of a doc file (using “UpdateFields()”). Windows 7, the TOC is updated correctly but not on Windows Server 2008 R2. I have Aspose 14.3 on both machines.

On Windows 7 (with Office 2010):


  1. General 2
  2. Presentation 2
    2.1. data 2
    2.2. definition 2*

On Windows Server 2008 R2 (without Office 2010):


The TOC use some custom styles: { TOC \o “1-3” \h \z \t “ELA-Title;4;Intro_Title1;2;Intro_Title2;3;Intro_Title3;4” }

See original file in the attachements.

Thanks for your help.

Hi Fabrice,

Thanks for your inquiry. Aspose.Words does not require Microsoft Word to be installed in order to run or function properly. It is an independent API. It should work in similar manner with or without Microsoft Office installed. Upon re-calculating TOC in your attached “UpdateTOC.docx” document, even Microsoft Word 2013 running on Windows 7 machine shows a single entry i.e. “INTRODUCTION 2”. This seems to be an expected behavior. If we can help you with anything else, please feel free to ask.

Best regards,

But when I update the TOC with Microsoft Office 2010 (on Windows 7), all titles are displayed.

EDIT: I made other tests and I saw that I had this “problem” on machines with Windows in English and I had all levels on a machine with Windows in French. There may be a link…

Hi Fabrice,

Thanks for your inquiry. Setting English language for Windows 7 and French as an editing language for Microsoft Word unfortunately didn’t help us to reproduce this issue on our end. It would be great if you please list all steps to reproduce this issue here for our reference. This will definitely help us to get to the bottom of this problem.

Best regards,

I understood why I had this behavior. The TOC was created with the
regional options set to french, and the list separator is “;” so the TOC
{ TOC \o "1-3" \h \z \t "ELA-Title;4;Intro_Title1;2;Intro_Title2;3;Intro_Title3;4" }

But in english, the list separator is “,”, and the TOC must be:
{ TOC \o "1-3" \h \z \t "ELA-Title,4,Intro_Title1,2;Intro_Title2,3,Intro_Title3,4" }

As I update the TOC with regional options in english, I have to replace “;” by “,” in the TOC before updating:

Aspose.Words.NodeCollection fieldStarts = doc.GetChildNodes(Aspose.Words.NodeType.FieldStart, true);
foreach (Aspose.Words.Fields.FieldStart fieldStart in fieldStarts)
    if (fieldStart.FieldType == Aspose.Words.Fields.FieldType.FieldTOC)
        Aspose.Words.Node fieldSeparator = fieldStart.NextSibling;
        fieldSeparator.Range.Replace(";", System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.ListSeparator, false, false);

Hi Fabrice,

Thanks for the details. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,