TableAlignment

Inheritance: java.lang.Object

public class TableAlignment

Specifies alignment for an inline table.

Examples:

Shows how to apply an outline border to a table.


 Document doc = new Document(getMyDir() + "Tables.docx");
 Table table = doc.getFirstSection().getBody().getTables().get(0);

 // Align the table to the center of the page.
 table.setAlignment(TableAlignment.CENTER);

 // Clear any existing borders and shading from the table.
 table.clearBorders();
 table.clearShading();

 // Add green borders to the outline of the table.
 table.setBorder(BorderType.LEFT, LineStyle.SINGLE, 1.5, Color.GREEN, true);
 table.setBorder(BorderType.RIGHT, LineStyle.SINGLE, 1.5, Color.GREEN, true);
 table.setBorder(BorderType.TOP, LineStyle.SINGLE, 1.5, Color.GREEN, true);
 table.setBorder(BorderType.BOTTOM, LineStyle.SINGLE, 1.5, Color.GREEN, true);

 // Fill the cells with a light green solid color.
 table.setShading(TextureIndex.TEXTURE_SOLID, Color.GREEN, Color.GREEN);

 doc.save(getArtifactsDir() + "Table.SetOutlineBorders.docx");
 

Fields

FieldDescription
CENTERThe table is centered.
LEFTThe table is aligned to the left.
RIGHTThe table is aligned to the right.
length

Methods

MethodDescription
fromName(String tableAlignmentName)
getName(int tableAlignment)
getValues()
toString(int tableAlignment)

CENTER

public static int CENTER

The table is centered.

LEFT

public static int LEFT

The table is aligned to the left.

public static int RIGHT

The table is aligned to the right.

length

public static int length

fromName(String tableAlignmentName)

public static int fromName(String tableAlignmentName)

Parameters:

ParameterTypeDescription
tableAlignmentNamejava.lang.String

Returns: int

getName(int tableAlignment)

public static String getName(int tableAlignment)

Parameters:

ParameterTypeDescription
tableAlignmentint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int tableAlignment)

public static String toString(int tableAlignment)

Parameters:

ParameterTypeDescription
tableAlignmentint

Returns: java.lang.String