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

Represents a table in the Word document.

Signature
C#
C#
[DefaultMember("Item")]
 public sealed class Table : Element
{signature}{signature:
}
Signature
vb.net
vb.net
<DefaultMember("Item")> _
	Public NotInheritable Class Table
		Inherits Element
{signature}
{remarks}To create a new table, use [
Remarks

To create a new table, use Element.InsertTableBefore()

|Element.InsertTableBefore]

or

[

InsertTableAfter()

|Element

.

InsertTableAfter].

To

get

an

existing

table,

use

[

Element.GetElements

|Element.GetElements(Element.Type)]

or

[

Element.Children

|Element.Children]

and

check

which

elements

are

of

type

[

Element.Type.Table

|Element.Type#Table]. The following sample demonstrates inserting a new table at the end of a document as well as finding the first table in a document. {remarks} {example}{code:csharp|title=C#}

.

The following sample demonstrates inserting a new table at the end of a document as well as finding the first table in a document.

Example
Code Block
csharp
csharp
titleC#


          //--- Insert a table at the end of a new document with 3 rows and 5 columns
          WordApplication app = new WordApplication();
          Document doc = app.Create();
          Table table = doc.InsertTableAfter(3, 5);

          //--- Get the first table of an existing document
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Table table = doc.GetElements(Element.Type.Table)[0];
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Insert a table at the end of a new document with 3 rows and 5 columns
          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim table As Table = doc.InsertTableAfter(3, 5)

          '--- Get the first table of an existing document
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim table As Table = doc.GetElements(Element.Type.Table)(0)
        
{code} {example} {properties} ||Name||Description|| |[AbsolutePositioning|Table.AbsolutePositioning]|{excerpt-include:Table.AbsolutePositioning|nopanel=true}| |[Formatting|Table.Formatting]|{excerpt-include:Table.Formatting|nopanel=true}| |[NumRows|Table.NumRows]|{excerpt-include:Table.NumRows|nopanel=true}| |[PreferredWidth|Table.PreferredWidth]|{excerpt-include:Table.PreferredWidth|nopanel=true}| |[Style|Table.Style]|{excerpt-include:Table.Style|nopanel=true}| {indexers} ||Name||Description|| |[Item(Int32, Int32)|
Properties

Name

Description

AbsolutePositioning

Excerpt Include
Table.AbsolutePositioning
Table.AbsolutePositioning
nopaneltrue

Formatting

Excerpt Include
Table.Formatting
Table.Formatting
nopaneltrue

NumRows

Excerpt Include
Table.NumRows
Table.NumRows
nopaneltrue

PreferredWidth

Excerpt Include
Table.PreferredWidth
Table.PreferredWidth
nopaneltrue

Style

Excerpt Include
Table.Style
Table.Style
nopaneltrue
Indexers

Name

Description

Item(Int32, Int32)

Excerpt Include
Table.Item(Int32,

...

Int32)

...

Table.Item(Int32,

...

Int32)

...

nopanel

...

true
Methods

Name

Description

AddColumns(Int32)

...

Excerpt Include
Table.AddColumns(Int32)

...

Table.AddColumns(Int32)

...

nopanel

...

...

Excerpt Include
Table.AddRows(Int32)

...

Table.AddRows(Int32)

...

nopanel

...

...

...

Excerpt Include
Table.CreateBookmarkOnRow(Int32,

...

String)

...

Table.CreateBookmarkOnRow(Int32,

...

String)

...

nopanel

...

...

...

{excerpt-include:Table.DeleteColumns(Int32,

...

...

...

Excerpt Include
Table.DeleteRows(Int32,

...

Int32)

...

Table.DeleteRows(Int32,

...

Int32)

...

nopanel

...

...

Excerpt Include
Table.GetNumColumns(Int32)

...

Table.GetNumColumns(Int32)

...

nopanel

...

...

Excerpt Include
Table.GetPreferredColumnWidth(Int32)

...

Table.GetPreferredColumnWidth(Int32)

...

nopanel

...

...

Excerpt Include
Table.GetPreferredColumnWidthUnits(Int32)

...

Table.GetPreferredColumnWidthUnits(Int32)

...

nopanel

...

...

...

Excerpt Include
Table.GetPreferredWidth(out

...

Units)

...

Table.GetPreferredWidth(out

...

Units)

...

nopanel

...

...

Excerpt Include
Table.GetRowHeight(Int32)

...

Table.GetRowHeight(Int32)

...

nopanel

...

...

Excerpt Include
Table.GetRowHeightExact(Int32)

...

Table.GetRowHeightExact(Int32)

...

nopanel

...

...

Excerpt Include
Table.ImportDataRow(Object())

...

Table.ImportDataRow(Object())

...

nopanel

...

...

...

Excerpt Include
Table.InsertColumns(Int32,

...

Int32)

...

Table.InsertColumns(Int32,

...

Int32)

...

nopanel

...

...

...

Excerpt Include
Table.InsertRows(Int32,

...

Int32)

...

Table.InsertRows(Int32,

...

Int32)

...

nopanel

...

...

...

...

...

Excerpt Include
Table.MergeCells(Int32,

...

Int32,

...

Int32,

...

Int32)

...

Table.MergeCells(Int32,

...

Int32,

...

Int32,

...

Int32)

...

nopanel

...

...

...

Excerpt Include
Table.SetPreferredColumnWidth(Int32,

...

Int32)

...

Table.SetPreferredColumnWidth(Int32,

...

Int32)

...

nopanel

...

...

...

Excerpt Include
Table.SetPreferredColumnWidthUnits(Int32,

...

TableCell.WidthUnits)

...

Table.SetPreferredColumnWidthUnits(Int32,

...

TableCell.WidthUnits)

...

nopanel

...

...

...

Excerpt Include
Table.SetPreferredWidth(Double,

...

Units)

...

Table.SetPreferredWidth(Double,

...

Units)

...

nopanel

...

...

...

Excerpt Include
Table.SetRowHeight(Int32,

...

Int32)

...

Table.SetRowHeight(Int32,

...

Int32)

...

nopanel

...

...

...

Excerpt Include
Table.SetRowHeightExact(Int32,

...

Boolean)

...

Table.SetRowHeightExact(Int32,

...

Boolean)

...

nopanel

...

true

...