java.lang.Object
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 with a table style applied.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.startTable();
// We must insert at least one row first before setting any table formatting
builder.insertCell();
// Set the table style used based of the unique style identifier
// Note that not all table styles are available when saving as .doc format
table.setStyleIdentifier(StyleIdentifier.MEDIUM_SHADING_1_ACCENT_1);
// Apply which features should be formatted by the style
table.setStyleOptions(TableStyleOptions.FIRST_COLUMN | TableStyleOptions.ROW_BANDS | TableStyleOptions.FIRST_ROW);
table.autoFit(AutoFitBehavior.AUTO_FIT_TO_CONTENTS);
// Continue with building the table as normal
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 int | NONE = 0 | |
No table style formatting is applied.
|
static final int | FIRST_ROW = 32 | |
Apply first row conditional formatting.
|
static final int | LAST_ROW = 64 | |
Apply last row conditional formatting.
|
static final int | FIRST_COLUMN = 128 | |
Apply 1 first column conditional formatting.
|
static final int | LAST_COLUMN = 256 | |
Apply last column conditional formatting.
|
static final int | ROW_BANDS = 512 | |
Apply row banding conditional formatting.
|
static final int | COLUMN_BANDS = 1024 | |
Apply column banding conditional formatting.
|
static final int | DEFAULT_2003 = 1536 | |
Row and column banding is applied. This is Microsoft Word default for old formats such as DOC, WML and RTF.
|
static final int | DEFAULT = 672 | |
This is Microsoft Word defaults.
|
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.