com.aspose.words
Class TableStyleOptions

java.lang.Object
    extended by com.aspose.words.TableStyleOptions

public class TableStyleOptions 
extends java.lang.Object

Utility class containing constants. Specifies how table style is applied to a table.

Example:

Shows how to build a new table while applying a style.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.startTable();

// We must insert at least one row before setting any table formatting.
builder.insertCell();

// Set the table style used based on the style identifier.
// Note that not all table styles are available when saving to .doc format.
table.setStyleIdentifier(StyleIdentifier.MEDIUM_SHADING_1_ACCENT_1);

// Partially apply the style to features of the table based on predicates, then build the table.
table.setStyleOptions(TableStyleOptions.FIRST_COLUMN | TableStyleOptions.ROW_BANDS | TableStyleOptions.FIRST_ROW);
table.autoFit(AutoFitBehavior.AUTO_FIT_TO_CONTENTS);

builder.writeln("Item");
builder.getCellFormat().setRightPadding(40.0);
builder.insertCell();
builder.writeln("Quantity (kg)");
builder.endRow();

builder.insertCell();
builder.writeln("Apples");
builder.insertCell();
builder.writeln("20");
builder.endRow();

builder.insertCell();
builder.writeln("Bananas");
builder.insertCell();
builder.writeln("40");
builder.endRow();

builder.insertCell();
builder.writeln("Carrots");
builder.insertCell();
builder.writeln("50");
builder.endRow();

doc.save(getArtifactsDir() + "DocumentBuilder.InsertTableWithStyle.docx");
See Also:
Table.StyleOptions

Field Summary
static final intNONE = 0
           No table style formatting is applied.
static final intFIRST_ROW = 32
           Apply first row conditional formatting.
static final intLAST_ROW = 64
           Apply last row conditional formatting.
static final intFIRST_COLUMN = 128
           Apply 1 first column conditional formatting.
static final intLAST_COLUMN = 256
           Apply last column conditional formatting.
static final intROW_BANDS = 512
           Apply row banding conditional formatting.
static final intCOLUMN_BANDS = 1024
           Apply column banding conditional formatting.
static final intDEFAULT_2003 = 1536
           Row and column banding is applied. This is Microsoft Word default for old formats such as DOC, WML and RTF.
static final intDEFAULT = 672
           This is Microsoft Word defaults.
 

Field Detail

NONE = 0

public static final int NONE
No table style formatting is applied.

FIRST_ROW = 32

public static final int FIRST_ROW
Apply first row conditional formatting.

LAST_ROW = 64

public static final int LAST_ROW
Apply last row conditional formatting.

FIRST_COLUMN = 128

public static final int FIRST_COLUMN
Apply 1 first column conditional formatting.

LAST_COLUMN = 256

public static final int LAST_COLUMN
Apply last column conditional formatting.

ROW_BANDS = 512

public static final int ROW_BANDS
Apply row banding conditional formatting.

COLUMN_BANDS = 1024

public static final int COLUMN_BANDS
Apply column banding conditional formatting.

DEFAULT_2003 = 1536

public static final int DEFAULT_2003
Row and column banding is applied. This is Microsoft Word default for old formats such as DOC, WML and RTF.

DEFAULT = 672

public static final int DEFAULT
This is Microsoft Word defaults.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.