TabStop Class
Represents a single custom tab stop. The TabStop object is a member of the TabStopCollection collection.
Inheritance Hierarchy

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
public sealed class TabStop

The TabStop type exposes the following members.

Public methodTabStop(Double)
Initializes a new instance of this class.
Public methodTabStop(Double, TabAlignment, TabLeader)
Initializes a new instance of this class.
Public propertyCode exampleAlignment
Gets or sets the alignment of text at this tab stop.
Public propertyIsClear
Returns true if this tab stop clears any existing tab stops in this position.
Public propertyCode exampleLeader
Gets or sets the type of the leader line displayed under the tab character.
Public propertyCode examplePosition
Gets the position of the tab stop in points.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodEquals(TabStop)
Compares with the specified TabStop.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

Normally, a tab stop specifies a position where a tab stop exists. But because tab stops can be inherited from parent styles, it might be needed for the child object to define explicitly that there is no tab stop at a given position. To clear an inherited tab stop at a given position, create a TabStop object and set Alignment to TabAlignment.Clear.

For more information see TabStopCollection.

Shows how to modify the position of the right tab stop in TOC related paragraphs.

Document doc = new Document(MyDir + "Document.TableOfContents.doc");

// Iterate through all paragraphs in the document
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>())
    // Check if this paragraph is formatted using the TOC result based styles. This is any style between TOC and TOC9.
    if (para.ParagraphFormat.Style.StyleIdentifier >= StyleIdentifier.Toc1 &&
        para.ParagraphFormat.Style.StyleIdentifier <= StyleIdentifier.Toc9)
        // Get the first tab used in this paragraph, this should be the tab used to align the page numbers.
        TabStop tab = para.ParagraphFormat.TabStops[0];
        // Remove the old tab from the collection.
        // Insert a new tab using the same properties but at a modified position. 
        // We could also change the separators used (dots) by passing a different Leader type
        para.ParagraphFormat.TabStops.Add(tab.Position - 50, tab.Alignment, tab.Leader);

doc.Save(ArtifactsDir + "Document.TableOfContentsTabStops.doc");
See Also