Range.ConvertToTable Method

Converts text within a range or selection to a table.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Function ConvertToTable ( _
    ByRef Separator As Object, _
    ByRef NumRows As Object, _
    ByRef NumColumns As Object, _
    ByRef InitialColumnWidth As Object, _
    ByRef Format As Object, _
    ByRef ApplyBorders As Object, _
    ByRef ApplyShading As Object, _
    ByRef ApplyFont As Object, _
    ByRef ApplyColor As Object, _
    ByRef ApplyHeadingRows As Object, _
    ByRef ApplyLastRow As Object, _
    ByRef ApplyFirstColumn As Object, _
    ByRef ApplyLastColumn As Object, _
    ByRef AutoFit As Object, _
    ByRef AutoFitBehavior As Object, _
    ByRef DefaultTableBehavior As Object _
) As Table
'Usage
Dim instance As Range
Dim Separator As Object
Dim NumRows As Object
Dim NumColumns As Object
Dim InitialColumnWidth As Object
Dim Format As Object
Dim ApplyBorders As Object
Dim ApplyShading As Object
Dim ApplyFont As Object
Dim ApplyColor As Object
Dim ApplyHeadingRows As Object
Dim ApplyLastRow As Object
Dim ApplyFirstColumn As Object
Dim ApplyLastColumn As Object
Dim AutoFit As Object
Dim AutoFitBehavior As Object
Dim DefaultTableBehavior As Object
Dim returnValue As Table

returnValue = instance.ConvertToTable(Separator, _
    NumRows, NumColumns, InitialColumnWidth, _
    Format, ApplyBorders, ApplyShading, _
    ApplyFont, ApplyColor, ApplyHeadingRows, _
    ApplyLastRow, ApplyFirstColumn, _
    ApplyLastColumn, AutoFit, AutoFitBehavior, _
    DefaultTableBehavior)
Table ConvertToTable(
    ref Object Separator,
    ref Object NumRows,
    ref Object NumColumns,
    ref Object InitialColumnWidth,
    ref Object Format,
    ref Object ApplyBorders,
    ref Object ApplyShading,
    ref Object ApplyFont,
    ref Object ApplyColor,
    ref Object ApplyHeadingRows,
    ref Object ApplyLastRow,
    ref Object ApplyFirstColumn,
    ref Object ApplyLastColumn,
    ref Object AutoFit,
    ref Object AutoFitBehavior,
    ref Object DefaultTableBehavior
)

Parameters

  • Separator
    Type: System.Object%
    Optional Object. Specifies the character used to separate text into cells. Can be a character or a WdTableFieldSeparator constant. If this argument is omitted, the value of the DefaultTableSeparator property is used.
  • NumRows
    Type: System.Object%
    Optional Object. The number of rows in the table. If this argument is omitted, Word sets the number of rows, based on the contents of the range.
  • NumColumns
    Type: System.Object%
    Optional Object. The number of columns in the table. If this argument is omitted, Word sets the number of columns, based on the contents of the range.
  • InitialColumnWidth
    Type: System.Object%
    Optional Object. The initial width of each column, in points. If this argument is omitted, Word calculates and adjusts the column width so that the table stretches from margin to margin.
  • Format
    Type: System.Object%
    Optional Object. Specifies one of the predefined formats listed in the Table AutoFormat dialog box (Table menu). Can be one of the WdTableFormat constants.
  • ApplyBorders
    Type: System.Object%
    Optional Object. True to apply the border properties of the specified format.
  • ApplyShading
    Type: System.Object%
    Optional Object. True to apply the shading properties of the specified format.
  • ApplyFont
    Type: System.Object%
    Optional Object. True to apply the font properties of the specified format.
  • ApplyColor
    Type: System.Object%
    Optional Object. True to apply the color properties of the specified format.
  • ApplyHeadingRows
    Type: System.Object%
    Optional Object. True to apply the heading-row properties of the specified format.
  • ApplyLastRow
    Type: System.Object%
    Optional Object. True to apply the last-row properties of the specified format.
  • ApplyFirstColumn
    Type: System.Object%
    Optional Object. True to apply the first-column properties of the specified format.
  • ApplyLastColumn
    Type: System.Object%
    Optional Object. True to apply the last-column properties of the specified format.
  • AutoFit
    Type: System.Object%
    Optional Object. True to decrease the width of the table columns as much as possible without changing the way text wraps in the cells.
  • AutoFitBehavior
    Type: System.Object%
    Optional Object. Sets the AutoFit rules for how Word sizes a table. Can be one of the WdAutoFitBehavior constants. If DefaultTableBehavior is wdWord8TableBehavior, this argument is ignored.
  • DefaultTableBehavior
    Type: System.Object%
    Optional Object. Sets a value that specifies whether Microsoft Word automatically resizes cells in a table to fit the contents (AutoFit). Can be a WdDefaultTableBehavior constant.

Return Value

Type: Microsoft.Office.Interop.Word.Table

See Also

Reference

Range Interface

Range Members

Microsoft.Office.Interop.Word Namespace