Table module
- class Table.Table
Bases:
BodyRegion,IBodyRegion,ITable,ICompositeObjectRepresents a table in a document.
- AddCaption(name: str, format: CaptionNumberingFormat, captionPosition: CaptionPosition) IParagraph
Add a caption for the current table.
- ApplyHorizontalMerge(rowIndex: int, startCellIndex: int, endCellIndex: int)
Applies horizontal merging for cells of table row.
- Parameters:
rowIndex – Index of the row.
startCellIndex – Start index of the cell.
endCellIndex – End index of the cell.
- ApplyStyle(builtinTableStyle: DefaultTableStyle)
Applies the built-in table style.
- Parameters:
builtinTableStyle (DefaultTableStyle) – The built-in table style.
- ApplyTableStyle()
Applies the table style properties to table and cell.
- ApplyVerticalMerge(columnIndex: int, startRowIndex: int, endRowIndex: int)
Applies the vertical merge for table cells.
- Parameters:
columnIndex – Index of the column.
startRowIndex – Start index of the row.
endRowIndex – End index of the row.
- AutoFit(behavior: AutoFitBehaviorType)
Determines how Microsoft Word resizes a table when the AutoFit feature is used.
- Parameters:
behavior – How Word resizes the specified table with the AutoFit feature is used.
- property ChildObjects: DocumentObjectCollection
Get the child entities of the table.
- property ColumnWidth: List[float]
Gets or sets the width of each column.
- property DefaultColumnWidth: float
Gets or sets the default width of each column.
- property DefaultColumnsNumber: int
Gets or sets the default number of columns in the table.
- property DefaultRowHeight: float
Gets or sets the default row height, the unit of measure is point, 1point = 0.3528 mm.
- property DocumentObjectType: DocumentObjectType
Gets the type of the document object.
- Find(pattern: Regex) TextSelection
Finds text by specified pattern.
- Parameters:
pattern – The pattern.
- Returns:
TextSelection object if found, None otherwise.
- property FirstRow: TableRow
Get the first row of the table.
- property Format: TableFormat
Gets the table formatting after ResetCells call.
- property IndentFromLeft: float
Get or set the indent from the left for the table.
- property LastCell: TableCell
Gets the last cell in the table.
- property LastRow: TableRow
Get the last row of the table.
- property PreferredWidth: PreferredWidth
Gets or sets the preferred horizontal width of the table.
- RemoveAbsPosition()
Removes the absolute position data. If table has absolute position in the document, all position data will be erased.
- Replace
Replaces all entries of matchString regular expression with newValue string.
- Parameters:
pattern (Regex) – The pattern.
replace (str) – Replace text.
- Returns:
The number of replacements made.
- Return type:
int
- ResetCells
Reset the number of rows and columns in the table.
- property Rows: RowCollection
Gets the collection of rows in the table.
- SetColumnWidth(columnIndex: int, columnWidth: float, columnWidthType: CellWidthType)
Sets the width of all cells in the current column of the table.
- Parameters:
columnIndex – Index of the column.
columnWidth – The column width.
columnWidthType – The column width type.
- property TableDescription: str
Get or set the description of the table.
- property TableFormat: RowFormat
Gets the table formatting after ResetCells call.
- property TableStyleName: str
Gets the name of the table style.
- property Title: str
Get or set the title of the table.
- property Width: float
Get the width of the table.
- get_Item(row: int, column: int) TableCell
Get a table cell by row and column indexes.
