Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
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#
Wiki Markup
{description}
{excerpt}The [TableFormatting|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.{excerpt}
{signature:C#}
 public sealed class TableFormatting
Signature
{signature}{signature:vb.net
vb.net
}
Public NotInheritable Class TableFormatting
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.

{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#}

          //--- 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:vb.net
|title=vb.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)
        
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle
Properties

...

Name

...

Description

...

AutoWidth

...

{code}

{example}
{properties}
||Name||Description||
|[AutoWidth|TableFormatting.AutoWidth]|{excerpt-include:TableFormatting.AutoWidth

...

CantSplit

|nopanel=true}|
|[CantSplit|TableFormatting.CantSplit]|{excerpt-include

...

:TableFormatting.CantSplit

...

DefaultShading

|nopanel=true}|
|[DefaultShading|TableFormatting.DefaultShading]|{excerpt-include

...

:TableFormatting.DefaultShading

...

DefaultSpacing

|nopanel=true}|
|[DefaultSpacing|TableFormatting.DefaultSpacing]|{excerpt-include

...

:TableFormatting.DefaultSpacing

...

Justification

|nopanel=true}|
|[Justification|TableFormatting.Justification]|{excerpt-include

...

:TableFormatting.Justification

...

LeftIndent

|nopanel=true}|
|[LeftIndent|TableFormatting.LeftIndent]|{excerpt-include

...

:TableFormatting.LeftIndent

...

RepeatAsHeader

|nopanel=true}|
|[RepeatAsHeader|TableFormatting.RepeatAsHeader]|{excerpt-include

...

:TableFormatting.RepeatAsHeader

...

Methods

...

Name

...

Description

|nopanel=true}|
{methods}
||Name||Description||
|[GetDefaultBorder(Border.Location)

...

|TableFormatting.GetDefaultBorder(Border.Location)

...

]|{excerpt-include:TableFormatting.GetDefaultBorder(Border.Location)

...

|nopanel

...

=true}|
|[GetDefaultPadding(TableCell.Location)

...

|TableFormatting.GetDefaultPadding(TableCell.Location)

...

]|{excerpt-include:TableFormatting.GetDefaultPadding(TableCell.Location)

...

|nopanel

...

=true}|
|[SetDefaultPadding(TableCell.Location, Int32)

...

|TableFormatting.SetDefaultPadding(TableCell.Location, Int32)

...

]|{excerpt-include:TableFormatting.SetDefaultPadding(TableCell.Location, Int32)

...

|nopanel

...

=true}|