TableStyle class
TableStyle class
Represents a table style. To learn more, visit the Working with Tables documentation article.
Inheritance: TableStyle → Style
Properties
Name | Description |
---|---|
aliases | Gets all aliases of this style. If style has no aliases then empty array of string is returned. (Inherited from Style) |
alignment | Specifies the alignment for the table style. |
allow_break_across_pages | Gets or sets a flag indicating whether text in a table row is allowed to split across a page break. |
automatically_update | Specifies whether this style is automatically redefined based on the appropriate value. (Inherited from Style) |
base_style_name | Gets/sets the name of the style this style is based on. (Inherited from Style) |
bidi | Gets or sets whether this is a style for a right-to-left table. |
borders | Gets the collection of default cell borders for the style. |
bottom_padding | Gets or sets the amount of space (in points) to add below the contents of table cells. |
built_in | True if this style is one of the built-in styles in MS Word. (Inherited from Style) |
cell_spacing | Gets or sets the amount of space (in points) between the cells. |
column_stripe | Gets or sets a number of columns to include in the banding when the style specifies odd/even columns banding. |
conditional_styles | Collection of conditional styles that may be defined for this table style. |
document | Gets the owner document. (Inherited from Style) |
font | Gets the character formatting of the style. (Inherited from Style) |
is_heading | True when the style is one of the built-in Heading styles. (Inherited from Style) |
is_quick_style | Specifies whether this style is shown in the Quick Style gallery inside MS Word UI. (Inherited from Style) |
left_indent | Gets or sets the value that represents the left indent of a table. |
left_padding | Gets or sets the amount of space (in points) to add to the left of the contents of table cells. |
linked_style_name | Gets/sets the name of the Style linked to this one. Returns empty string if no styles are linked. (Inherited from Style) |
list | Gets the list that defines formatting of this list style. (Inherited from Style) |
list_format | Provides access to the list formatting properties of a paragraph style. (Inherited from Style) |
locked | Specifies whether this style is locked. (Inherited from Style) |
name | Gets or sets the name of the style. (Inherited from Style) |
next_paragraph_style_name | Gets/sets the name of the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style. (Inherited from Style) |
paragraph_format | Gets the paragraph formatting of the style. (Inherited from Style) |
priority | Gets/sets the integer value that represents the priority for sorting the styles in the Styles task pane. (Inherited from Style) |
right_padding | Gets or sets the amount of space (in points) to add to the right of the contents of table cells. |
row_stripe | Gets or sets a number of rows to include in the banding when the style specifies odd/even row banding. |
semi_hidden | Gets/sets whether the style hides from the Styles gallery and from the Styles task pane. (Inherited from Style) |
shading | Gets a Shading object that refers to the shading formatting for table cells. |
style_identifier | Gets the locale independent style identifier for a built-in style. (Inherited from Style) |
styles | Gets the collection of styles this style belongs to. (Inherited from Style) |
top_padding | Gets or sets the amount of space (in points) to add above the contents of table cells. |
type | Gets the style type (paragraph or character). (Inherited from Style) |
unhide_when_used | Gets/sets whether the style used in the current document unhides from the Styles gallery and from the Styles task pane. True when the used style should be shown in the Styles gallery. (Inherited from Style) |
vertical_alignment | Specifies the vertical alignment for the cells. |
Methods
Name | Description |
---|---|
equals(style) | Compares with the specified style. Styles Istds are compared for built-in styles only. Styles defaults are not included in comparison. Base style, linked style and next paragraph style are recursively compared. (Inherited from Style) |
remove() | Removes the specified style from the document. (Inherited from Style) |
Examples
Shows how to create custom style settings for the table.
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
table = builder.start_table()
builder.insert_cell()
builder.write('Name')
builder.insert_cell()
builder.write('مرحبًا')
builder.end_row()
builder.insert_cell()
builder.insert_cell()
builder.end_table()
table_style = doc.styles.add(aw.StyleType.TABLE, 'MyTableStyle1').as_table_style()
table_style.allow_break_across_pages = True
table_style.bidi = True
table_style.cell_spacing = 5
table_style.bottom_padding = 20
table_style.left_padding = 5
table_style.right_padding = 10
table_style.top_padding = 20
table_style.shading.background_pattern_color = aspose.pydrawing.Color.antique_white
table_style.borders.color = aspose.pydrawing.Color.blue
table_style.borders.line_style = aw.LineStyle.DOT_DASH
table_style.vertical_alignment = aw.tables.CellVerticalAlignment.CENTER
table.style = table_style
# Setting the style properties of a table may affect the properties of the table itself.
self.assertTrue(table.bidi)
self.assertEqual(5.0, table.cell_spacing)
self.assertEqual('MyTableStyle1', table.style_name)
doc.save(ARTIFACTS_DIR + 'Table.table_style_creation.docx')
See Also
- module aspose.words
- class Style