Insert bulleted TOC field using C#

I want to display bulletin points in table of contents.

My code is below

Aspose.Words.Document wdMainDoc = new Aspose.Words.Document(fileName.ToString());
DocumentBuilder builder = new DocumentBuilder(wdMainDoc);

                        builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");

builder.inserthtml("");
wdmaindoc.Updatefields();
wdmaindoc.save();

Thanks;

@Ramyamai

In your case, you need to set the bullet list to paragraphs those have heading styles. After calling Document.UpdateFields method, you will get the desired output.

If you still face problem, please ZIP and attach your input and expected output documents here for our reference. We will then provide you more information about your query along with code example.

@tahir.manzoor

I am still not getting the bulleting points for TOC.
I have attached ZIP files for your reference.
I am using Microsoft word 2010 for your information.

Kindly do the needful.
Bullets.zip (71.3 KB)

@Ramyamai

Unfortunately, it is difficult to say what the problem is without documents and code example. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor

Please find the attachment of zip file and do the needful.Bullets.zip (90.0 KB)

@Ramyamai

In your case, you need to use DocumentBuilder.InsertHtml method (String, Boolean) as shown below to get the desired output. Please pass the value of second parameter as true.

builder.InsertHtml("...html....", true);

@tahir.manzoor

Thanks for your response.Its working fine now.

@Ramyamai

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.