com.aspose.words

Class TableAlignment

  • java.lang.Object
    • com.aspose.words.TableAlignment
public class TableAlignment 
extends java.lang.Object

Utility class containing constants. Specifies alignment for an inline table.

Example:

Shows how to apply a outline border to a table.
Document doc = new Document(getMyDir() + "Tables.docx");
Table table = (Table) doc.getChild(NodeType.TABLE, 0, true);

// 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();

// Set a green border around the table but not inside
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");

Field Summary
static final intLEFT = 0
The table is aligned to the left.
static final intCENTER = 1
The table is centered.
static final intRIGHT = 2
The table is aligned to the right.
 

    • Field Detail

      • LEFT = 0

        public static final int LEFT
        The table is aligned to the left.
      • CENTER = 1

        public static final int CENTER
        The table is centered.
      • RIGHT = 2

        public static final int RIGHT
        The table is aligned to the right.