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

Free Support Forum - aspose.com

How to Insert List of Appendices after TOC using C#

How to insert LOA(List of appendices) in a word document using C#

@Syedfahad

Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

Here I’am attaching my code and sample document
please help me how to generate lOA(List of appendices) below table of content.Code.zip (41.3 KB)
Code.zip (41.3 KB)

@Syedfahad

In your case, you need to insert TOC filed using DocumentBuilder.InsertField and set the custom style and identifier for table of figures. Following code example shows how to insert list of appendices after TOC field.

Please note that your input document does not contains the TOC field. Please insert the TOC field at the start of input document and then use this code.

Document doc = new Document(MyDir + "LOA.docx");
Field toc = doc.Range.Fields[0];
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveTo(toc.End);
builder.Writeln();
FieldToc field = (FieldToc)builder.InsertField(FieldType.FieldTOC, true);
                
field.CustomStyles = "Caption";
field.TableOfFiguresLabel = "Apendax";

field.Update();

doc.Save(MyDir + @"21.9.docx");