Tables.Add Method
Returns a Table object that represents a new, blank table added to a document.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)
Syntax
'Declaration
Function Add ( _
Range As Range, _
NumRows As Integer, _
NumColumns As Integer, _
ByRef DefaultTableBehavior As Object, _
ByRef AutoFitBehavior As Object _
) As Table
'Usage
Dim instance As Tables
Dim Range As Range
Dim NumRows As Integer
Dim NumColumns As Integer
Dim DefaultTableBehavior As Object
Dim AutoFitBehavior As Object
Dim returnValue As Table
returnValue = instance.Add(Range, NumRows, _
NumColumns, DefaultTableBehavior, _
AutoFitBehavior)
Table Add(
Range Range,
int NumRows,
int NumColumns,
ref Object DefaultTableBehavior,
ref Object AutoFitBehavior
)
Parameters
- Range
Type: Microsoft.Office.Interop.Word.Range
Required Range object. The range where you want the table to appear. The table replaces the range, if the range isn't collapsed.
- NumRows
Type: System.Int32
Required Integer. The number of rows you want to include in the table.
- NumColumns
Type: System.Int32
Required Integer. The number of columns you want to include in the table.
- DefaultTableBehavior
Type: System.Object%
Optional Object. Sets a value that specifies whether Word automatically resizes cells in tables to fit the cells’ contents (AutoFit). Can be either of the following constants: wdWord8TableBehavior (AutoFit disabled) or wdWord9TableBehavior (AutoFit enabled). The default constant is wdWord8TableBehavior.
- AutoFitBehavior
Type: System.Object%
Optional Object. Sets the AutoFit rules for how Microsoft Word sizes tables. Can be one of the following WdAutoFitBehavior constants: wdAutoFitContent, wdAutoFitFixed, or wdAutoFitWindow. If DefaultTableBehavior is set to wdWord8TableBehavior, this argument is ignored.
Return Value
Type: Microsoft.Office.Interop.Word.Table