Represents a table in the Word document.

[DefaultMember("Item")]
 public sealed class Table : Element
<DefaultMember("Item")> _
	Public NotInheritable Class Table
		Inherits Element

To create a new table, use Element.InsertTableBefore() or InsertTableAfter(). To get an existing table, use Element.GetElements or Element.Children and check which elements are of type 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.


          //--- 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];
        

          '--- 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)
        

Name

Description

AbsolutePositioning

Formatting

NumRows

PreferredWidth

Style

Name

Description

Item(Int32, Int32)

Name

Description

AddColumns(Int32)

AddRows(Int32)

CreateBookmarkOnRow(Int32, String)

DeleteColumns(Int32, Int32)

{excerpt-include:Table.DeleteColumns(Int32,

DeleteRows(Int32, Int32)

GetNumColumns(Int32)

GetPreferredColumnWidth(Int32)

GetPreferredColumnWidthUnits(Int32)

GetPreferredWidth(out Units)

GetRowHeight(Int32)

GetRowHeightExact(Int32)

ImportDataRow(Object())

InsertColumns(Int32, Int32)

InsertRows(Int32, Int32)

MergeCells(Int32, Int32, Int32, Int32)

SetPreferredColumnWidth(Int32, Int32)

SetPreferredColumnWidthUnits(Int32, TableCell.WidthUnits)

SetPreferredWidth(Double, Units)

SetRowHeight(Int32, Int32)

SetRowHeightExact(Int32, Boolean)