Click or drag to resize
TabStopLeader Enumeration
Represents the characters which may be used to fill in the space created by a tab which ends at this custom TabStop. The chosen character shall be repeated as required to completely fill the tab spacing generated by the tab character.

Namespace: GemBox.Document
Assembly: GemBox.Document (in GemBox.Document.dll) Version: 25.3.30.1231
Syntax
public enum TabStopLeader
Members
  Member nameValueDescription
None0 Specifies that there shall be no leader character.
Dot1 Specifies that the leader character shall be a dot [.].
Hyphen2 Specifies that the leader character shall be a hyphen [-].
Underscore3 Specifies that the leader character shall be an underscore [_].
Remarks

Creating customized tabs in a document is accomplished with TabStop structure that enables you to define tab position, tab leader character and surrounding text alignment.

TabStops should be inserted into ParagraphFormat.Tabs collection to be used in a Paragraph.

Tabs are inserted into a document content with SpecialCharacter elements that have SpecialCharacter.CharacterType property equal to Tab.

Values Bar and List are currently not supported in PDF, XPS and image file formats.

Examples

Following example shows how to define customized tab stops and insert the tabs in document content.

// Create a new empty document.
var doc = new DocumentModel();

// Define document content and paragraph formatting in one code statement.
doc.Sections.Add(
    new Section(doc,
        new Paragraph(doc,
            // Add two lines of text: first with text and tabs, second with only tabs - so tab stop position, tab stop alignment and tab stop leader values can be observed more closely.
            new Run(doc, "First"),
            new SpecialCharacter(doc, SpecialCharacterType.Tab),
            new Run(doc, "Second"),
            new SpecialCharacter(doc, SpecialCharacterType.Tab),
            new Run(doc, "Third"),
            new SpecialCharacter(doc, SpecialCharacterType.Tab),
            new Run(doc, "Fourth"),
            new SpecialCharacter(doc, SpecialCharacterType.LineBreak),
            new SpecialCharacter(doc, SpecialCharacterType.Tab),
            new SpecialCharacter(doc, SpecialCharacterType.Tab),
            new SpecialCharacter(doc, SpecialCharacterType.Tab))
        {
            ParagraphFormat = new ParagraphFormat()
            {
                Tabs =
                {
                    // Define three tab stops, with different alignments and leader characters, each ending 1000 points after the previous one.
                    new TabStop(100, TabStopAlignment.Left, TabStopLeader.Dot),
                    new TabStop(200, TabStopAlignment.Center, TabStopLeader.Hyphen),
                    new TabStop(300, TabStopAlignment.Right, TabStopLeader.Underscore)
                }
            }
        }));

// Document will be saved on the Desktop.
var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "TabStops.docx");

// Save the document.
doc.Save(path);

// Open the document in Microsoft Word.
System.Diagnostics.Process.Start(path);
See Also