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)

'Usage
Dim Range As Range
Dim NumRows As Integer
Dim NumColumns As Integer
Dim DefaultTableBehavior As Object
Dim AutoFitBehavior As Object
Dim returnValue As Table
Dim tables1 As Tables
returnValue = tables1.Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)

Table Add(
	[In] Range Range, 
	[In] int NumRows, 
	[In] int NumColumns, 
	[In, Optional] ref object DefaultTableBehavior, 
	[In, Optional] ref object AutoFitBehavior
);
public Table Add(
	/*in*/Range Range, 
	/*in*/int NumRows, 
	/*in*/int NumColumns, 
	/*in*/System.Object DefaultTableBehavior, 
	/*in*/System.Object AutoFitBehavior
);
function Add(
	 Range : Range, 
	 NumRows : int, 
	 NumColumns : int, 
	 DefaultTableBehavior : Object, 
	 AutoFitBehavior : Object
) : Table;

Parameters

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

Required Integer. The number of rows you want to include in the table.

NumColumns

Required Integer. The number of columns you want to include in the table.

DefaultTableBehavior

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

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Anzeigen: