Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Description

The TableFormatting class is used to specify formatting that should be applied to a table. It also represents the table formatting of some named styles in the document.

C#
vb.net

Remarks

There are two ways to obtain an instance of this class: Create a new normal table formatting object using Document.CreateTableFormatting(). This will return a copy of a particular style's table formatting. The TableFormatting object that is returned can then be used in conjunction with methods in the Element class to create tables with specific formatting.

The following example demonstrates both ways of getting table formatting, first by retrieving the NormalTable style's paragraph formatting from the document, second by retrieving a copy of the TableSimple1 style's paragraph formatting.

Examples

C#
vb.net

Properties

Name

Description

AutoWidth

Returns a boolean that represents whether or not this table's width will be set automatically by Word.

CantSplit

Sets or returns a boolean that represents whether or not Word will attempt to keep a table created with this formatting on one page.

DefaultShading

Returns an Shading object which on which you can manipulate the default shading (fill color and/or pattern) properties of a table's cells that has this formatting.

DefaultSpacing

Returns or sets an int that represents the default spacing between a table's cells that has this formatting. This is the distance in twips between the edge of a cell and the center of its border with an adjacent cell. One twip = (1/20 pt) or (1/1440 in)

Justification

Sets or returns a ParagraphFormatting.Justification object that represents the justification for a table created with this formatting. Possible values: Left, Center, Right, LeftRight.

LeftIndent

Sets or returns an int that represents the left indent for a table created with this formatting in twips. One twip = (1/20 pt) or (1/1440 in).

RepeatAsHeader

Sets or returns a boolean that represents if Word will repeat the first row of a table created with this formatting as a header across multiple pages.

Methods

Name

Description

GetDefaultBorder(Border.Location)

Returns a Border object that represents the default border for table cells at a specified location for a table created with this formatting. Individual table cells can override these border settings. Allowed locations are: Top, Left, Bottom, Right, Vertical, and Horizontal. Top, Left, Bottom, and Right refer to the default border for those sides of a table cell. Vertical and Horizontal refer to the border between table cells.

GetDefaultPadding(TableCell.Location)

Returns an int that represents the default table cell margin at a particular location. One twip = (1/20 pt) or (1/1440 in)

SetDefaultPadding(TableCell.Location, Int32)

Sets an int that represents the default table cell margin at a particular location. One twip = (1/20 pt) or (1/1440 in)
  • No labels