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

Free Support Forum - aspose.com

Problem with TOC

Hi guys,


I’m using Aspose Word to export word. Right now I’m having issue with list level and TOC.
I’ve defined my list style by the way:
var list = doc.Lists.Add(ListTemplate.OutlineHeadingsLegal);
// Level 1 labels will be “Appendix A”.
list.ListLevels[0].NumberFormat = “Appendix \x0000.”;
list.ListLevels[0].NumberStyle = NumberStyle.UppercaseLetter;
list.ListLevels[0].Font.Size = 20;
list.ListLevels[0].TextPosition = -4;
// Level 2 labels will be “A.1.”
list.ListLevels[1].NumberFormat = “\x0000.\x0001.”;
list.ListLevels[1].NumberStyle = NumberStyle.Arabic;
list.ListLevels[1].Font.Size = 14;
list.ListLevels[1].TextPosition = -4;
// Level 3 labels will be “A.1.1.”.
list.ListLevels[2].NumberFormat = “\x0000.\x0001.\x0002.”;
list.ListLevels[2].NumberStyle = NumberStyle.Arabic;
list.ListLevels[2].Font.Size = 11;
list.ListLevels[2].NumberPosition = 36;
// Level 4 labels will be “a.1.”.
list.ListLevels[3].NumberFormat = “\x0003.\x0001.”;
list.ListLevels[3].NumberStyle = NumberStyle.LowercaseLetter;
       <span style="color:green;">// Make labels of all list levels bold.</span>
       <span style="color:blue;">foreach</span> (<span style="color:#2b91af;">ListLevel</span> level <span style="color:blue;">in</span> list.ListLevels)
       {
           level.Font.Bold = <span style="color:blue;">true</span>;
           level.Alignment = <span style="color:#2b91af;">ListLevelAlignment</span>.Left;
           level.TabPosition = 36;
       }</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">And I inserted TOC by the way:builder.InsertTableOfContents(<span style="color: rgb(163, 21, 21);">"\\o \"1-4\" \\h"</span>);<br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Afterbind data into document, I updated field document but it doesn't work and TOC show as attach file.</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Please help me to fix it.</pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Thanks,</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Hanh</pre></div>

Hi Hanh,

Can you please also share a document to show your expected output? It would be better if you share a one or two page expected output document to highlight the problematic area only.

Best Regards,