Tab stops are used in Word documents to enable text alignment by pressing the Tab key from the keyboard. There are generally five types of tab stops, namely, left, right, center, decimal, and bar tab.
DsWord allows you to specify tab stop properties for a paragraph using the TabStop class which can be accessed using TabStops property of the ParagraphFormat class. It supports all the five types of tab stops which can be set using Alignment property of the TabStop class. This property takes value from the TabStopAlignment enumeration.
To get the tab stops:
C# |
Copy Code |
---|---|
//Get tab stops Console.WriteLine("Tab Stop: "+ doc.Body.Sections.First.GetRange().Paragraphs.Last.Format.TabStops[0].Position); |
To set the tab stops:
C# |
Copy Code |
---|---|
//Set tab stops
doc.Body.Sections.First.GetRange().Paragraphs.Last.Format.TabStops.Add(20, TabStopAlignment.Bar); |
For more information on how to implement tab stops using DsWord, see DsWord sample browser.