java.lang.Object
com.aspose.words.TabAlignment
public class TabAlignment
- extends java.lang.Object
Utility class containing constants.
Specifies the alignment/type of a tab stop.
Example:
Shows how to set custom tab stops for a paragraph.
Document doc = new Document();
Paragraph para = doc.getFirstSection().getBody().getFirstParagraph();
// If we are in a paragraph with no tab stops in this collection,
// the cursor will jump 36 points each time we press the Tab key in Microsoft Word.
Assert.assertEquals(0, doc.getFirstSection().getBody().getFirstParagraph().getEffectiveTabStops().length);
// We can add custom tab stops in Microsoft Word if we enable the ruler via the "View" tab.
// Each unit on this ruler is two default tab stops, which is 72 points.
// We can add custom tab stops programmatically like this.
TabStopCollection tabStops = doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat().getTabStops();
tabStops.add(72.0, TabAlignment.LEFT, TabLeader.DOTS);
tabStops.add(216.0, TabAlignment.CENTER, TabLeader.DASHES);
tabStops.add(360.0, TabAlignment.RIGHT, TabLeader.LINE);
// We can see these tab stops in Microsoft Word by enabling the ruler via "View" -> "Show" -> "Ruler".
Assert.assertEquals(3, para.getEffectiveTabStops().length);
// Any tab characters we add will make use of the tab stops on the ruler and may,
// depending on the tab leader's value, leave a line between the tab departure and arrival destinations.
para.appendChild(new Run(doc, "\tTab 1\tTab 2\tTab 3"));
doc.save(getArtifactsDir() + "Paragraph.TabStops.docx");
|
Field Summary |
static final int | LEFT = 0 | |
|
Left-aligns the text after the tab stop.
|
static final int | CENTER = 1 | |
|
Centers the text around the tab stop.
|
static final int | RIGHT = 2 | |
|
Right-aligns the text at the tab stop.
|
static final int | DECIMAL = 3 | |
|
Aligns the text at the decimal dot.
|
static final int | BAR = 4 | |
|
Draws a vertical bar at the tab stop position.
|
static final int | LIST = 6 | |
|
The tab is a delimiter between the number/bullet and text in a list item.
|
static final int | CLEAR = 7 | |
|
Clears any tab stop in this position.
|
LEFT = 0 | |
public static final int LEFT |
-
Left-aligns the text after the tab stop.
CENTER = 1 | |
public static final int CENTER |
-
Centers the text around the tab stop.
RIGHT = 2 | |
public static final int RIGHT |
-
Right-aligns the text at the tab stop.
DECIMAL = 3 | |
public static final int DECIMAL |
-
Aligns the text at the decimal dot.
BAR = 4 | |
public static final int BAR |
-
Draws a vertical bar at the tab stop position.
LIST = 6 | |
public static final int LIST |
-
The tab is a delimiter between the number/bullet and text in a list item.
CLEAR = 7 | |
public static final int CLEAR |
-
Clears any tab stop in this position.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.