|
Programmer's Reference >
WordApplication API >
TableFormatting
The TableFormatting Object
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. 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:
[csharp]
// Get NormalTable formatting from Document
WordApplication app = new WordApplication();
Document doc = app.Create();
TableFormatting normalTableFormatting = doc.CreateTableFormatting();
// Get paragraph formatting from SimpleTable1 Style
WordApplication app = new WordApplication();
Document doc = app.Create();
TableFormatting simpleTable1Formatting = doc.Styles[NamedStyle.BuiltIn.SimpleTable1];
[vbnet]
' Get NormalTable formatting from Document
Dim app As WordApplication = new WordApplication()
Dim doc As Document = app.Create()
Dim normalTableFormatting As TableFormatting = doc.CreateTableFormatting()
' Get paragraph formatting from SimpleTable1 Style
Dim app As WordApplication = new WordApplication()
Dim doc As Document = app.Create()
Dim simpleTable1Formatting As TableFormatting = doc.Styles(NamedStyle.BuiltIn.SimpleTable1)
TableFormatting Properties
| Property |
Type |
Access |
Description |
| AutoWidth |
boolean
|
read write |
Returns a boolean that represents whether or not this table's width will be set automatically by Word
|
| CantSplit |
boolean
|
read write |
Sets or returns a boolean that represents whether or not Word will attempt to keep a table created with this formatting on one page
|
| DefaultBorder |
Border
|
read |
Returns a Border object that represents the default border for table cells at a specified location for a table created with this formatting
|
| DefaultPadding |
int
|
read write |
Returns or sets an int that represents the default table cell margin at a particular location
|
| DefaultShading |
Shading
|
read |
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 |
int
|
read write |
Returns or sets an int that represents the default spacing between a table's cells that has this formatting
|
| Justification |
ParagraphFormatting.Justification
|
read write |
Sets or returns a ParagraphFormatting.Justification object that represents the justification for a table created with this formatting
|
| LeftIndent |
int
|
read write |
Sets or returns an int that represents the left indent for a table created with this formatting in twips
|
| RepeatAsHeader |
boolean
|
read write |
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
|
This object does not have any methods defined.

Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.
|