Click or drag to resize

StyleTemplateType Enumeration

Type that determines predefined style.

Namespace: SautinSoft.Document
Assembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.7.18
Syntax
public enum StyleTemplateType
Members
Member nameValueDescription
DefaultParagraphFont0'DefaultParagraphFont' CharacterStyle.
Strong1'Strong' CharacterStyle.
Emphasis2'Emphasis' CharacterStyle.
SubtleEmphasis3'SubtleEmphasis' CharacterStyle.
IntenseEmphasis4'IntenseEmphasis' CharacterStyle.
SubtleReference5'SubtleReference' CharacterStyle.
IntenseReference6'IntenseReference' CharacterStyle.
BookTitle7'BookTitle' CharacterStyle.
Hyperlink8'Hyperlink' CharacterStyle.
Normal9'Normal' ParagraphStyle.
Heading110'Heading 1' ParagraphStyle.
Heading211'Heading 2' ParagraphStyle.
Heading312'Heading 3' ParagraphStyle.
Heading413'Heading 4' ParagraphStyle.
Heading514'Heading 5' ParagraphStyle.
Heading615'Heading 6' ParagraphStyle.
Heading716'Heading 7' ParagraphStyle.
Heading817'Heading 8' ParagraphStyle.
Heading918'Heading 9' ParagraphStyle.
Title19'Title' ParagraphStyle.
Subtitle20'Subtitle' ParagraphStyle.
NoSpacing21'NoSpacing' ParagraphStyle.
Quote22'Quote' ParagraphStyle.
IntenseQuote23'IntenseQuote' ParagraphStyle.
ListParagraph24'ListParagraph' ParagraphStyle.
TableNormal25'Normal Table' TableStyle (MS WORD 2010).
TableGrid26'Table Grid' TableStyle (MS WORD 2010).
LightShading27'Light Shading' TableStyle (MS WORD 2010).
LightShadingAccent128'Light Shading Accent 1' TableStyle (MS WORD 2010).
LightShadingAccent229'Light Shading Accent 2' TableStyle (MS WORD 2010).
LightShadingAccent330'Light Shading Accent 3' TableStyle (MS WORD 2010).
LightShadingAccent431'Light Shading Accent 4' TableStyle (MS WORD 2010).
LightShadingAccent532'Light Shading Accent 5' TableStyle (MS WORD 2010).
LightShadingAccent633'Light Shading Accent 6' TableStyle (MS WORD 2010).
LightList34'Light List' TableStyle (MS WORD 2010).
LightListAccent135'Light List Accent 1' TableStyle (MS WORD 2010).
LightListAccent236'Light List Accent 2' TableStyle (MS WORD 2010).
LightListAccent337'Light List Accent 3' TableStyle (MS WORD 2010).
LightListAccent438'Light List Accent 4' TableStyle (MS WORD 2010).
LightListAccent539'Light List Accent 5' TableStyle (MS WORD 2010).
LightListAccent640'Light List Accent 6' TableStyle (MS WORD 2010).
LightGrid41'Light Grid' TableStyle (MS WORD 2010).
LightGridAccent142'Light Grid Accent 1' TableStyle (MS WORD 2010).
LightGridAccent243'Light Grid Accent 2' TableStyle (MS WORD 2010).
LightGridAccent344'Light Grid Accent 3' TableStyle (MS WORD 2010).
LightGridAccent445'Light Grid Accent 4' TableStyle (MS WORD 2010).
LightGridAccent546'Light Grid Accent 5' TableStyle (MS WORD 2010).
LightGridAccent647'Light Grid Accent 6' TableStyle (MS WORD 2010).
MediumShading148'Medium Shading 1' TableStyle (MS WORD 2010).
MediumShading1Accent149'Medium Shading 1 Accent 1' TableStyle (MS WORD 2010).
MediumShading1Accent250'Medium Shading 1 Accent 2' TableStyle (MS WORD 2010).
MediumShading1Accent351'Medium Shading 1 Accent 3' TableStyle (MS WORD 2010).
MediumShading1Accent452'Medium Shading 1 Accent 4' TableStyle (MS WORD 2010).
MediumShading1Accent553'Medium Shading 1 Accent 5' TableStyle (MS WORD 2010).
MediumShading1Accent654'Medium Shading 1 Accent 6' TableStyle (MS WORD 2010).
MediumShading255'Medium Shading 2' TableStyle (MS WORD 2010).
MediumShading2Accent156'Medium Shading 2 Accent 1' TableStyle (MS WORD 2010).
MediumShading2Accent257'Medium Shading 2 Accent 2' TableStyle (MS WORD 2010).
MediumShading2Accent358'Medium Shading 2 Accent 3' TableStyle (MS WORD 2010).
MediumShading2Accent459'Medium Shading 2 Accent 4' TableStyle (MS WORD 2010).
MediumShading2Accent560'Medium Shading 2 Accent 5' TableStyle (MS WORD 2010).
MediumShading2Accent661'Medium Shading 2 Accent 6' TableStyle (MS WORD 2010).
MediumList162'Medium List 1' TableStyle (MS WORD 2010).
MediumList1Accent163'Medium List 1 Accent 1' TableStyle (MS WORD 2010).
MediumList1Accent264'Medium List 1 Accent 2' TableStyle (MS WORD 2010).
MediumList1Accent365'Medium List 1 Accent 3' TableStyle (MS WORD 2010).
MediumList1Accent466'Medium List 1 Accent 4' TableStyle (MS WORD 2010).
MediumList1Accent567'Medium List 1 Accent 5' TableStyle (MS WORD 2010).
MediumList1Accent668'Medium List 1 Accent 6' TableStyle (MS WORD 2010).
MediumList269'Medium List 2' TableStyle (MS WORD 2010).
MediumList2Accent170'Medium List 2 Accent 1' TableStyle (MS WORD 2010).
MediumList2Accent271'Medium List 2 Accent 2' TableStyle (MS WORD 2010).
MediumList2Accent372'Medium List 2 Accent 3' TableStyle (MS WORD 2010).
MediumList2Accent473'Medium List 2 Accent 4' TableStyle (MS WORD 2010).
MediumList2Accent574'Medium List 2 Accent 5' TableStyle (MS WORD 2010).
MediumList2Accent675'Medium List 2 Accent 6' TableStyle (MS WORD 2010).
MediumGrid176'Medium Grid 1' TableStyle (MS WORD 2010).
MediumGrid1Accent177'Medium Grid 1 Accent 1' TableStyle (MS WORD 2010).
MediumGrid1Accent278'Medium Grid 1 Accent 2' TableStyle (MS WORD 2010).
MediumGrid1Accent379'Medium Grid 1 Accent 3' TableStyle (MS WORD 2010).
MediumGrid1Accent480'Medium Grid 1 Accent 4' TableStyle (MS WORD 2010).
MediumGrid1Accent581'Medium Grid 1 Accent 5' TableStyle (MS WORD 2010).
MediumGrid1Accent682'Medium Grid 1 Accent 6' TableStyle (MS WORD 2010).
MediumGrid283'Medium Grid 2' TableStyle (MS WORD 2010).
MediumGrid2Accent184'Medium Grid 2 Accent 1' TableStyle (MS WORD 2010).
MediumGrid2Accent285'Medium Grid 2 Accent 2' TableStyle (MS WORD 2010).
MediumGrid2Accent386'Medium Grid 2 Accent 3' TableStyle (MS WORD 2010).
MediumGrid2Accent487'Medium Grid 2 Accent 4' TableStyle (MS WORD 2010).
MediumGrid2Accent588'Medium Grid 2 Accent 5' TableStyle (MS WORD 2010).
MediumGrid2Accent689'Medium Grid 2 Accent 6' TableStyle (MS WORD 2010).
MediumGrid390'Medium Grid 3' TableStyle (MS WORD 2010).
MediumGrid3Accent191'Medium Grid 3 Accent 1' TableStyle (MS WORD 2010).
MediumGrid3Accent292'Medium Grid 3 Accent 2' TableStyle (MS WORD 2010).
MediumGrid3Accent393'Medium Grid 3 Accent 3' TableStyle (MS WORD 2010).
MediumGrid3Accent494'Medium Grid 3 Accent 4' TableStyle (MS WORD 2010).
MediumGrid3Accent595'Medium Grid 3 Accent 5' TableStyle (MS WORD 2010).
MediumGrid3Accent696'Medium Grid 3 Accent 6' TableStyle (MS WORD 2010).
DarkList97'Dark List' TableStyle (MS WORD 2010).
DarkListAccent198'Dark List Accent 1' TableStyle (MS WORD 2010).
DarkListAccent299'Dark List Accent 2' TableStyle (MS WORD 2010).
DarkListAccent3100'Dark List Accent 3' TableStyle (MS WORD 2010).
DarkListAccent4101'Dark List Accent 4' TableStyle (MS WORD 2010).
DarkListAccent5102'Dark List Accent 5' TableStyle (MS WORD 2010).
DarkListAccent6103'Dark List Accent 6' TableStyle (MS WORD 2010).
ColorfulShading104'Colorful Shading' TableStyle (MS WORD 2010).
ColorfulShadingAccent1105'Colorful Shading Accent 1' TableStyle (MS WORD 2010).
ColorfulShadingAccent2106'Colorful Shading Accent 2' TableStyle (MS WORD 2010).
ColorfulShadingAccent3107'Colorful Shading Accent 3' TableStyle (MS WORD 2010).
ColorfulShadingAccent4108'Colorful Shading Accent 4' TableStyle (MS WORD 2010).
ColorfulShadingAccent5109'Colorful Shading Accent 5' TableStyle (MS WORD 2010).
ColorfulShadingAccent6110'Colorful Shading Accent 6' TableStyle (MS WORD 2010).
ColorfulList111'Colorful List' TableStyle (MS WORD 2010).
ColorfulListAccent1112'Colorful List Accent 1' TableStyle (MS WORD 2010).
ColorfulListAccent2113'Colorful List Accent 2' TableStyle (MS WORD 2010).
ColorfulListAccent3114'Colorful List Accent 3' TableStyle (MS WORD 2010).
ColorfulListAccent4115'Colorful List Accent 4' TableStyle (MS WORD 2010).
ColorfulListAccent5116'Colorful List Accent 5' TableStyle (MS WORD 2010).
ColorfulListAccent6117'Colorful List Accent 6' TableStyle (MS WORD 2010).
ColorfulGrid118'Colorful Grid' TableStyle (MS WORD 2010).
ColorfulGridAccent1119'Colorful Grid Accent 1' TableStyle (MS WORD 2010).
ColorfulGridAccent2120'Colorful Grid Accent 2' TableStyle (MS WORD 2010).
ColorfulGridAccent3121'Colorful Grid Accent 3' TableStyle (MS WORD 2010).
ColorfulGridAccent4122'Colorful Grid Accent 4' TableStyle (MS WORD 2010).
ColorfulGridAccent5123'Colorful Grid Accent 5' TableStyle (MS WORD 2010).
ColorfulGridAccent6124'Colorful Grid Accent 6' TableStyle (MS WORD 2010).
Example

See Developer Guide: Insert a TOC (Table of Contents) field

Insert a TOC (Table of Contents) field using C#
using System;
using SautinSoft.Document;
using System.Text;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            // Get your free 100-day key here:   
            // https://sautinsoft.com/start-for-free/
            InsertingToc();
        }
        /// <summary>
        /// Insert a TOC (Table of Contents) field into the document using DocumentBuilder.
        /// </summary>
        /// <remarks>
        /// Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/documentbuilder-inserting-toc.php
        /// </remarks>

        static void InsertingToc()
        {
            DocumentCore dc = new DocumentCore();
            DocumentBuilder db = new DocumentBuilder(dc);

            // Insert the formatted text into the document using DocumentBuilder.
            db.CharacterFormat.FontName = "Verdana";
            db.CharacterFormat.Size = 16;
            db.Writeln("Table of Contents.");
            db.CharacterFormat.ClearFormatting();

            // Insert Table of Contents field into the document at the current position.
            TableOfEntries toe = db.InsertTableOfContents("\\o \"1-3\" \\h");
            // For information about switches, see the description on the page above.

            // Add the text and divide it into headings.
            db.InsertSpecialCharacter(SpecialCharacterType.PageBreak);
            ParagraphStyle Heading1Style = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading1, dc);
            dc.Styles.Add(Heading1Style);
            db.ParagraphFormat.Style = Heading1Style;
            db.Writeln("Heading 1");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1" +
                "Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 ");

            ParagraphStyle Heading2Style = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading2, dc);
            dc.Styles.Add(Heading2Style);
            db.ParagraphFormat.Style = Heading2Style;
            db.Writeln("Heading 1.1");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1" +
                " Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1");
            db.ParagraphFormat.Style = Heading2Style;
            db.Writeln("Heading 1.2");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2" +
                " Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2 ");

            ParagraphStyle Heading3Style = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading3, dc);
            dc.Styles.Add(Heading3Style);
            db.ParagraphFormat.Style = Heading3Style;
            db.Writeln("Heading 1.1.1");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 1.1.1 Some text Heading 1.1.1 Some text Heading 1.1.1 Some text Heading 1.1.1 " +
                " Some text Heading 1.1.1 Some text Heading 1.1.1 Some text Heading 1.1.1 ");
            db.ParagraphFormat.Style = Heading3Style;
            db.Writeln("Heading 1.1.2");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text 1.1.2 Some text 1.1.2 Some text 1.1.2 Some text 1.1.2");

            db.ParagraphFormat.Style = Heading1Style;
            db.Writeln("Heading 2");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 2 Some text Heading 2.");

            db.ParagraphFormat.Style = Heading1Style;
            db.Writeln("Heading 3");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 3 Some text Heading 3 Some text Heading 3 Some text Heading 3 Some text Heading 3" +
                 "Some text Heading 3Some text Heading 3Some text Heading 3Some text Heading 3Some text Heading 3");

            db.ParagraphFormat.Style = Heading2Style;
            db.Writeln("Heading 3.1");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1" +
               "Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1");

            db.ParagraphFormat.Style = Heading2Style;
            db.Writeln("Heading 3.2");
            db.ParagraphFormat.ClearFormatting();
            db.Writeln("Some text Heading 3.2 Some text Heading 3.2 Some text Heading 3.2 Some text Heading 3.2 Some text Heading 3.2");

            // Update the TOC field (table of contents).
            toe.Update();

            // Save our document into DOCX format.
            string resultPath = @"Result.docx";
            dc.Save(resultPath, new DocxSaveOptions());

            // Important for Linux: Install MS Fonts
            // sudo apt install ttf-mscorefonts-installer -y

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(resultPath) { UseShellExecute = true });
        }
    }
}
Insert a TOC (Table of Contents) field using VB.Net
Imports System
Imports SautinSoft.Document
Imports System.Text

Namespace Example
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            InsertingToc()
        End Sub
                ''' Get your free 100-day key here:   
                ''' https://sautinsoft.com/start-for-free/
        ''' <summary>
        ''' Insert a TOC (Table of Contents) field into the document using DocumentBuilder.
        ''' </summary>
        ''' <remarks>
        ''' Details: https://www.sautinsoft.com/products/document/help/net/developer-guide/documentbuilder-inserting-toc.php
        ''' </remarks>

        Private Shared Sub InsertingToc()
            Dim dc As New DocumentCore()
            Dim db As New DocumentBuilder(dc)

            ' Insert the formatted text into the document using DocumentBuilder.
            db.CharacterFormat.FontName = "Verdana"
            db.CharacterFormat.Size = 16
            db.Writeln("Table of Contents.")
            db.CharacterFormat.ClearFormatting()

            ' Insert Table of Contents field into the document at the current position.
            Dim toe As TableOfEntries = db.InsertTableOfContents("\o ""1-3"" \h")
            ' For information about switches, see the description on the page above.

            ' Add the text and divide it into headings.
            db.InsertSpecialCharacter(SpecialCharacterType.PageBreak)
            Dim Heading1Style As ParagraphStyle = CType(Style.CreateStyle(StyleTemplateType.Heading1, dc), ParagraphStyle)
            dc.Styles.Add(Heading1Style)
            db.ParagraphFormat.Style = Heading1Style
            db.Writeln("Heading 1")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1" & "Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 Some text Heading 1 ")

            Dim Heading2Style As ParagraphStyle = CType(Style.CreateStyle(StyleTemplateType.Heading2, dc), ParagraphStyle)
            dc.Styles.Add(Heading2Style)
            db.ParagraphFormat.Style = Heading2Style
            db.Writeln("Heading 1.1")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1" & " Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1 Some text Heading 1.1")
            db.ParagraphFormat.Style = Heading2Style
            db.Writeln("Heading 1.2")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2" & " Some text Heading 1.2 Some text Heading 1.2 Some text Heading 1.2 ")

            Dim Heading3Style As ParagraphStyle = CType(Style.CreateStyle(StyleTemplateType.Heading3, dc), ParagraphStyle)
            dc.Styles.Add(Heading3Style)
            db.ParagraphFormat.Style = Heading3Style
            db.Writeln("Heading 1.1.1")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 1.1.1 Some text Heading 1.1.1 Some text Heading 1.1.1 Some text Heading 1.1.1 " & " Some text Heading 1.1.1 Some text Heading 1.1.1 Some text Heading 1.1.1 ")
            db.ParagraphFormat.Style = Heading3Style
            db.Writeln("Heading 1.1.2")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text 1.1.2 Some text 1.1.2 Some text 1.1.2 Some text 1.1.2")

            db.ParagraphFormat.Style = Heading1Style
            db.Writeln("Heading 2")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 2 Some text Heading 2.")

            db.ParagraphFormat.Style = Heading1Style
            db.Writeln("Heading 3")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 3 Some text Heading 3 Some text Heading 3 Some text Heading 3 Some text Heading 3" & "Some text Heading 3Some text Heading 3Some text Heading 3Some text Heading 3Some text Heading 3")

            db.ParagraphFormat.Style = Heading2Style
            db.Writeln("Heading 3.1")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1" & "Some text Heading 3.1 Some text Heading 3.1 Some text Heading 3.1")

            db.ParagraphFormat.Style = Heading2Style
            db.Writeln("Heading 3.2")
            db.ParagraphFormat.ClearFormatting()
            db.Writeln("Some text Heading 3.2 Some text Heading 3.2 Some text Heading 3.2 Some text Heading 3.2 Some text Heading 3.2")

            ' Update the TOC field (table of contents).
            toe.Update()

            ' Save our document into DOCX format.
            Dim resultPath As String = "result.docx"
            dc.Save(resultPath, New DocxSaveOptions())

            ' Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(resultPath) With {.UseShellExecute = True})
        End Sub
    End Class
End Namespace
See Also