Table
Overview
Table is a class in Aspose.Words FOSS for .NET.
Inherits from: CompositeNode.
Represents a table in a Word document.
This class provides 35 methods for working with Table objects in .NET programs.
Available methods include: Accept, AcceptEnd, AcceptStart, AppendChild, AutoFit, ClearBorders, ClearShading, Clone, ConvertToHorizontallyMergedCells, CreateNavigator, EnsureMinimum, GetAncestor, and 23 additional methods.
All public members are accessible to any .NET application after installing the Aspose.Words FOSS for .NET package.
Properties: AbsoluteHorizontalDistance, AbsoluteVerticalDistance, Alignment, AllowAutoFit, AllowCellSpacing, AllowOverlap, and 38 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
NodeType | NodeType | Read | Returns Table. |
FirstRow | Row | Read | Returns the first Row node in the table. |
LastRow | Row | Read | Returns the last Row node in the table. |
Rows | RowCollection | Read | Provides typed access to the rows of the table. |
Alignment | TableAlignment | Read/Write | Specifies how an inline table is aligned in the document. |
AllowAutoFit | bool | Read/Write | Allows Microsoft Word and Aspose.Words to automatically resize cells in a table to fit their contents. |
PreferredWidth | PreferredWidth | Read/Write | Gets or sets the table preferred width. |
Bidi | bool | Read/Write | Gets or sets whether this is a right-to-left table. |
LeftPadding | double | Read/Write | Gets or sets the amount of space (in points) to add to the left of the contents of cells. |
RightPadding | double | Read/Write | Gets or sets the amount of space (in points) to add to the right of the contents of cells. |
TopPadding | double | Read/Write | Gets or sets the amount of space (in points) to add above the contents of cells. |
BottomPadding | double | Read/Write | Gets or sets the amount of space (in points) to add below the contents of cells. |
CellSpacing | double | Read/Write | Gets or sets the amount of space (in points) between the cells. |
AllowCellSpacing | bool | Read/Write | Gets or sets the “Allow spacing between cells” option. |
LeftIndent | double | Read/Write | Gets or sets the value that represents the left indent of the table. |
StyleOptions | TableStyleOptions | Read/Write | Gets or sets bit flags that specify how a table style is applied to this table. |
Style | Style | Read/Write | Gets or sets the table style applied to this table. |
StyleName | string | Read/Write | Gets or sets the name of the table style applied to this table. |
StyleIdentifier | StyleIdentifier | Read/Write | Gets or sets the locale independent style identifier of the table style applied to this table. |
TextWrapping | TextWrapping | Read/Write | Gets or sets TextWrapping for table. |
Title | string | Read/Write | Gets or sets title of this table. |
Description | string | Read/Write | Gets or sets description of this table. |
DistanceLeft | double | Read/Write | Gets or sets distance between table left and the surrounding text, in points. |
DistanceRight | double | Read/Write | Gets or sets distance between table right and the surrounding text, in points. |
DistanceTop | double | Read/Write | Gets or sets distance between table top and the surrounding text, in points. |
DistanceBottom | double | Read/Write | Gets or sets distance between table bottom and the surrounding text, in points. |
RelativeHorizontalAlignment | HorizontalAlignment | Read/Write | Gets or sets floating table relative horizontal alignment. |
RelativeVerticalAlignment | VerticalAlignment | Read/Write | Gets or sets floating table relative vertical alignment. |
HorizontalAnchor | RelativeHorizontalPosition | Read/Write | Gets the base object from which the horizontal positioning of floating table should be calculated. |
VerticalAnchor | RelativeVerticalPosition | Read/Write | Gets the base object from which the vertical positioning of floating table should be calculated. |
AbsoluteHorizontalDistance | double | Read/Write | Gets or sets absolute horizontal floating table position specified by the table properties, in points. |
AbsoluteVerticalDistance | double | Read/Write | Gets or sets absolute vertical floating table position specified by the table properties, in points. |
AllowOverlap | bool | Read | Gets whether a floating table shall allow other floating objects in the document to overlap its extents when displayed. |
IsComposite | bool | Read | Returns true as this node can have child nodes. |
HasChildNodes | bool | Read | Returns true if this node has any child nodes. |
FirstChild | Node | Read | Gets the first child of the node. |
LastChild | Node | Read | Gets the last child of the node. |
Count | int | Read | Gets the number of immediate children of this node. |
ParentNode | CompositeNode | Read | Gets the immediate parent of this node. |
Document | DocumentBase | Read | Gets the document to which this node belongs. |
PreviousSibling | Node | Read | Gets the node immediately preceding this node. |
NextSibling | Node | Read | Gets the node immediately following this node. |
Range | Range | Read | Returns a Range object that represents the portion of a document that is contained in this node. |
CustomNodeId | int | Read/Write | Specifies custom node identifier. |
Methods
| Signature | Description |
|---|---|
Table(doc: DocumentBase) | Initializes a new instance of the Table class. |
ConvertToHorizontallyMergedCells() | Converts cells horizontally merged by width to cells merged by HorizontalMerge. |
Accept(visitor: DocumentVisitor) | Calls VisitTableStart, then calls Accept for all child nodes of the section and calls VisitTableEnd at the end. |
AcceptStart(visitor: DocumentVisitor) | Accepts a visitor for visiting the start of the table. |
AcceptEnd(visitor: DocumentVisitor) | Accepts a visitor for visiting the end of the table. |
EnsureMinimum() | If the table has no rows, creates and appends one Row. |
SetBorders(lineStyle: LineStyle, lineWidth: double, color: Color) | Sets all table borders to the specified line style, width and color. |
SetBorder(borderType: BorderType, lineStyle: LineStyle, lineWidth: double, color: Color, isOverrideCellBorders: bool) | Sets the specified table border to the specified line style, width and color. |
ClearBorders() | Removes all table and cell borders on this table. |
SetShading(texture: TextureIndex, foregroundColor: Color, backgroundColor: Color) | Sets shading to the specified values on whole table. |
ClearShading() | Removes all shading on the table. |
AutoFit(behavior: AutoFitBehavior) | Resizes the table and cells according to the specified auto fit behavior. |
GetText() | Gets the text of this node and of all its children. |
GetChildNodes(nodeType: NodeType, isDeep: bool) | Returns a collection of child nodes that match the specified type. |
GetChild(nodeType: NodeType, index: int, isDeep: bool) | Returns an Nth child node that matches the specified type. |
SelectNodes(xpath: string) | Selects a list of nodes matching the XPath expression. |
SelectSingleNode(xpath: string) | Selects the first Node that matches the XPath expression. |
GetEnumerator() | Provides support for the for each style iteration over the child nodes of this node. |
AppendChild(newChild: T) | Adds the specified node to the end of the list of child nodes for this node. |
PrependChild(newChild: T) | Adds the specified node to the beginning of the list of child nodes for this node. |
InsertAfter(newChild: T, refChild: Node) | Inserts the specified node immediately after the specified reference node. |
InsertBefore(newChild: T, refChild: Node) | Inserts the specified node immediately before the specified reference node. |
RemoveChild(oldChild: T) | Removes the specified child node. |
RemoveAllChildren() | Removes all the child nodes of the current node. |
RemoveSmartTags() | Removes all SmartTag descendant nodes of the current node. |
IndexOf(child: Node) | Returns the index of the specified child node in the child node array. |
CreateNavigator() | Creates navigator which can be used to traverse and read nodes. |
Clone(isCloneChildren: bool) | You should use the Clone(bool, INodeCloningListener) overload when the node cloning is a part of another (usually composite) node cloning process. |
GetAncestor(ancestorType: Type) | Gets the first ancestor of the specified object type. |
GetAncestorOf() | Calls GetAncestorOf on this Table instance. |
Remove() | Removes itself from the parent. |
NextPreOrder(rootNode: Node) | Gets next node according to the pre-order tree traversal algorithm. |
PreviousPreOrder(rootNode: Node) | Gets the previous node according to the pre-order tree traversal algorithm. |
ToString(saveFormat: SaveFormat) | Exports the content of the node into a string in the specified format. |
NodeTypeToString(nodeType: NodeType) | A utility method that converts a node type enum value into a user friendly string. |