TabStop Class |
Namespace: Aspose.Words
The TabStop type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | TabStop(Double) |
Initializes a new instance of this class.
|
![]() ![]() | TabStop(Double, TabAlignment, TabLeader) |
Initializes a new instance of this class.
|
Name | Description | |
---|---|---|
![]() ![]() | Alignment |
Gets or sets the alignment of text at this tab stop.
|
![]() ![]() | IsClear |
Returns true if this tab stop clears any existing tab stops in this position.
|
![]() ![]() | Leader |
Gets or sets the type of the leader line displayed under the tab character.
|
![]() ![]() | Position |
Gets the position of the tab stop in points.
|
Name | Description | |
---|---|---|
![]() | Equals(Object) | (Inherited from Object.) |
![]() ![]() | Equals(TabStop) |
Compares with the specified TabStop.
|
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | ToString | (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.
Document doc = new Document(MyDir + "Table of contents.docx"); // 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 para.ParagraphFormat.TabStops.RemoveByPosition(tab.Position); // 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 + "Styles.ChangeTocsTabStops.docx");