table of content field style

Hello, how Can I change the dotted spacing in a space inside the table of content fields?


            IWParagraph paragraph = page.AddParagraph();
            paragraph.ParagraphFormat.AfterSpacing = 10;
            paragraph.ParagraphFormat.BeforeSpacing = 10;
            paragraph.ParagraphFormat.LeftIndent = 150;


            IWTextRange title = paragraph.AppendText("Table of contents");
            title.CharacterFormat.FontSize = 25;
            title.CharacterFormat.FontName = "Arial";
            title.CharacterFormat.Bold = true;

            TableOfContent tableOfContents = paragraph.AppendTOC(1, 8);
            tableOfContents.IncludePageNumbers = true;
            tableOfContents.UseHeadingStyles = true;
            
            Style style = Style.CreateBuiltinStyle(BuiltinStyle.Toc1, document) as Style;
            style.CharacterFormat.Bold = true;
            style.CharacterFormat.FontSize = 12;
            style.CharacterFormat.FontName = "Arial";

            document.Styles.Add(style);
            document.UpdateTableOfContents();

1 Reply 1 reply marked as answer

HC Hemalatha Chiranjeevulu Syncfusion Team February 17, 2021 05:46 PM UTC

Hi Mathieu,

Thank you for contacting Syncfusion support.

From the given details, we found that your requirement is to change the dotted spacing in the table od content. To achieve this, we suggest you set the TabLeader property as none to the paragraphs in the table of contents. We have prepared the sample application to meet your requirement. Please use the below sample application at your end to achieve your requirement.

Sample link: https://www.syncfusion.com/downloads/support/forum/162628/ze/Sample1143961074

Please let us know if you have any other questions.

Regards,
Hemalatha C
 


Marked as answer
Loader.
Up arrow icon