none
How to update the style levels for TOC in word using VB.NET

    Question

  • Hi team,

             How will I update levels for the word TOC using VB.NET

    I want to change from attached image before.png to After.png

     Before.png:     https://1drv.ms/i/s!AkmlUDcbhtXiicZoKaJtsLP-J21M3A

     After.png :        https://1drv.ms/i/s!AkmlUDcbhtXiicZnlH45yWdurnUC2A

    Thanks in advance

    Tuesday, April 4, 2017 6:58 PM

All replies

  • Hi Prem-,

    According to your description, I find this article that may be helpful to you, please refer to:

    https://www.gemboxsoftware.com/document/examples/c-sharp-vb-net-create-update-word-toc/207

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 5, 2017 5:02 AM
    Moderator
  • Hi Prem,

    I think you can use Spire.Doc to create and update Table Of Contents in Word document.

    Refer to below code:

    Dim doc As New Document()
    Dim section As Section = doc.AddSection()
    Dim para As Paragraph = section.AddParagraph()
    
    para.AppendTOC(1, 3)
    Dim para1 As Paragraph = section.AddParagraph()
    para1.AppendText("Head1")
    
    para1.ApplyStyle(BuiltinStyle.Heading1)
    
    Dim para2 As Paragraph = section.AddParagraph()
    para2.AppendText("Head2")
    para2.ApplyStyle(BuiltinStyle.Heading2)
    
    doc.UpdateTableOfContents()
    doc.SaveToFile("CreateTableOfContent.docx", FileFormat.Docx)
    You can check the How to Create Table of Contents (TOC) in C# article for detailed information.

    Wednesday, April 5, 2017 5:53 AM