Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

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.

Signature
C#
C#
 public sealed class TableFormatting
{signature}{signature:
}
Signature
vb.net
vb.net
Public NotInheritable Class TableFormatting
{signature}
{remarks}There are two ways to obtain an instance of this class: Create a new normal table formatting object using [Document.CreateTableFormatting\(\)|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|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.

{remarks}
{example}{code:csharp|title=C#}
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.

Example
Code Block
csharp
csharp
titleC#


          //--- 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];
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Get NormalTable formatting from Document
          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim normalTableFormatting As TableFormatting = _
               doc.CreateTableFormatting()

          '--- Get paragraph formatting from SimpleTable1 Style
          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim simpleTable1Formatting As TableFormatting = _
               doc.Styles(NamedStyle.BuiltIn.SimpleTable1)
        
{code} {example} {properties} ||Name||Description|| |[AutoWidth|TableFormatting.AutoWidth]|{excerpt-include:TableFormatting.AutoWidth|nopanel=true}| |[CantSplit|TableFormatting.CantSplit]|{excerpt-include:TableFormatting.CantSplit|nopanel=true}| |[DefaultShading|TableFormatting.DefaultShading]|{excerpt-include:TableFormatting.DefaultShading|nopanel=true}| |[DefaultSpacing|TableFormatting.DefaultSpacing]|{excerpt-include:TableFormatting.DefaultSpacing|nopanel=true}| |[Justification|TableFormatting.Justification]|{excerpt-include:TableFormatting.Justification|nopanel=true}| |[LeftIndent|TableFormatting.LeftIndent]|{excerpt-include:TableFormatting.LeftIndent|nopanel=true}| |[RepeatAsHeader|TableFormatting.RepeatAsHeader]|{excerpt-include:TableFormatting.RepeatAsHeader|nopanel=true}| {methods} ||Name||Description|| |[GetDefaultBorder(Border.Location)|
Properties

Name

Description

AutoWidth

Excerpt Include
TableFormatting.AutoWidth
TableFormatting.AutoWidth
nopaneltrue

CantSplit

Excerpt Include
TableFormatting.CantSplit
TableFormatting.CantSplit
nopaneltrue

DefaultShading

Excerpt Include
TableFormatting.DefaultShading
TableFormatting.DefaultShading
nopaneltrue

DefaultSpacing

Excerpt Include
TableFormatting.DefaultSpacing
TableFormatting.DefaultSpacing
nopaneltrue

Justification

Excerpt Include
TableFormatting.Justification
TableFormatting.Justification
nopaneltrue

LeftIndent

Excerpt Include
TableFormatting.LeftIndent
TableFormatting.LeftIndent
nopaneltrue

RepeatAsHeader

Excerpt Include
TableFormatting.RepeatAsHeader
TableFormatting.RepeatAsHeader
nopaneltrue
Methods

Name

Description

GetDefaultBorder(Border.Location)

Excerpt Include
TableFormatting.GetDefaultBorder(Border.Location)

...

TableFormatting.GetDefaultBorder(Border.Location)

...

nopanel

...

...

Excerpt Include
TableFormatting.GetDefaultPadding(TableCell.Location)

...

TableFormatting.GetDefaultPadding(TableCell.Location)

...

nopanel

...

...

...

Excerpt Include
TableFormatting.SetDefaultPadding(TableCell.Location,

...

Int32)

...

TableFormatting.SetDefaultPadding(TableCell.Location,

...

Int32)

...

nopanel

...

true

...