following is how i add paragraph title to the TOC
- Code: Select all
//set the paragraph to be able to add into TOC
paragraph.ApplyStyle(BuiltinStyle.Heading1);
//remove the styling
paragraph.GetStyle().CharacterFormat.Bold = false;
paragraph.GetStyle().CharacterFormat.Italic = false;
//apply my custom Listformat
paragraph.ListFormat.ApplyStyle("levelstyle");
I try to let TOC append the same liststyle format but will encounter an exception. Any suggestion to let TOC follow the same format?
I can open the result document then update the TOC which will automatically change the format to match the content.