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

          //--- 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)
        {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)|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}|