com.aspose.words

Class ConditionalStyleType

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

Utility class containing constants. Represents possible table areas to which conditional formatting may be defined in a table style.

Example:

Shows how to work with certain area styles of a table.
Document doc = new Document(getMyDir() + "Table.ConditionalStyles.docx");

TableStyle tableStyle = (TableStyle) doc.getStyles().add(StyleType.TABLE, "MyTableStyle1");
// There is a different ways how to get conditional styles:
// by conditional style type
tableStyle.getConditionalStyles().getByConditionalStyleType(ConditionalStyleType.FIRST_ROW).getShading().setBackgroundPatternColor(Color.BLUE);
// by index
tableStyle.getConditionalStyles().get(0).getBorders().setColor(Color.BLACK);
tableStyle.getConditionalStyles().get(0).getBorders().setLineStyle(LineStyle.DOT_DASH);
Assert.assertEquals(tableStyle.getConditionalStyles().get(0).getType(), ConditionalStyleType.FIRST_ROW);
// directly from ConditionalStyleCollection
tableStyle.getConditionalStyles().getFirstRow().getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
// To see this in Word document select Total Row checkbox in Design Tab
tableStyle.getConditionalStyles().getLastRow().setBottomPadding(10.0);
tableStyle.getConditionalStyles().getLastRow().setLeftPadding(10.0);
tableStyle.getConditionalStyles().getLastRow().setRightPadding(10.0);
tableStyle.getConditionalStyles().getLastRow().setTopPadding(10.0);
// To see this in Word document select Last Column checkbox in Design Tab
tableStyle.getConditionalStyles().getLastColumn().getFont().setBold(true);

System.out.println(tableStyle.getConditionalStyles().getCount());
System.out.println(tableStyle.getConditionalStyles().get(0).getType());

Table table = (Table) doc.getChild(NodeType.TABLE, 0, true);
table.setStyle(tableStyle);

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

Field Summary
static final intFIRST_ROW = 0
Specifies formatting of the first row of a table.
static final intFIRST_COLUMN = 1
Specifies formatting of the first column of a table.
static final intLAST_ROW = 2
Specifies formatting of the last row of a table.
static final intLAST_COLUMN = 3
Specifies formatting of the last column of a table.
static final intODD_ROW_BANDING = 4
Specifies formatting of odd-numbered row stripe.
static final intODD_COLUMN_BANDING = 5
Specifies formatting of odd-numbered column stripe.
static final intEVEN_ROW_BANDING = 6
Specifies formatting of even-numbered row stripe.
static final intEVEN_COLUMN_BANDING = 7
Specifies formatting of even-numbered column stripe.
static final intTOP_LEFT_CELL = 8
Specifies formatting of the top left cell of a table.
static final intTOP_RIGHT_CELL = 9
Specifies formatting of the top right cell of a table.
static final intBOTTOM_LEFT_CELL = 10
Specifies formatting of the bottom left cell of a table.
static final intBOTTOM_RIGHT_CELL = 11
Specifies formatting of the bottom right cell of a table.
 

    • Field Detail

      • FIRST_ROW = 0

        public static final int FIRST_ROW
        Specifies formatting of the first row of a table.
      • FIRST_COLUMN = 1

        public static final int FIRST_COLUMN
        Specifies formatting of the first column of a table.
      • LAST_ROW = 2

        public static final int LAST_ROW
        Specifies formatting of the last row of a table.
      • LAST_COLUMN = 3

        public static final int LAST_COLUMN
        Specifies formatting of the last column of a table.
      • ODD_ROW_BANDING = 4

        public static final int ODD_ROW_BANDING
        Specifies formatting of odd-numbered row stripe.
      • ODD_COLUMN_BANDING = 5

        public static final int ODD_COLUMN_BANDING
        Specifies formatting of odd-numbered column stripe.
      • EVEN_ROW_BANDING = 6

        public static final int EVEN_ROW_BANDING
        Specifies formatting of even-numbered row stripe.
      • EVEN_COLUMN_BANDING = 7

        public static final int EVEN_COLUMN_BANDING
        Specifies formatting of even-numbered column stripe.
      • TOP_LEFT_CELL = 8

        public static final int TOP_LEFT_CELL
        Specifies formatting of the top left cell of a table.
      • TOP_RIGHT_CELL = 9

        public static final int TOP_RIGHT_CELL
        Specifies formatting of the top right cell of a table.
      • BOTTOM_LEFT_CELL = 10

        public static final int BOTTOM_LEFT_CELL
        Specifies formatting of the bottom left cell of a table.
      • BOTTOM_RIGHT_CELL = 11

        public static final int BOTTOM_RIGHT_CELL
        Specifies formatting of the bottom right cell of a table.