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)

Usage

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
Dim range1 As Range
returnValue = range1.ConvertToTable(Separator, NumRows, NumColumns, InitialColumnWidth, Format, ApplyBorders, ApplyShading, ApplyFont, ApplyColor, ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn, ApplyLastColumn, AutoFit, AutoFitBehavior, DefaultTableBehavior)

Syntax

Function ConvertToTable( _
    <InAttribute()> Optional ByRef Separator As Object, _
    <InAttribute()> Optional ByRef NumRows As Object, _
    <InAttribute()> Optional ByRef NumColumns As Object, _
    <InAttribute()> Optional ByRef InitialColumnWidth As Object, _
    <InAttribute()> Optional ByRef Format As Object, _
    <InAttribute()> Optional ByRef ApplyBorders As Object, _
    <InAttribute()> Optional ByRef ApplyShading As Object, _
    <InAttribute()> Optional ByRef ApplyFont As Object, _
    <InAttribute()> Optional ByRef ApplyColor As Object, _
    <InAttribute()> Optional ByRef ApplyHeadingRows As Object, _
    <InAttribute()> Optional ByRef ApplyLastRow As Object, _
    <InAttribute()> Optional ByRef ApplyFirstColumn As Object, _
    <InAttribute()> Optional ByRef ApplyLastColumn As Object, _
    <InAttribute()> Optional ByRef AutoFit As Object, _
    <InAttribute()> Optional ByRef AutoFitBehavior As Object, _
    <InAttribute()> Optional ByRef DefaultTableBehavior As Object _
) As Table
Table ConvertToTable(
    [In, Optional] ref object Separator, 
    [In, Optional] ref object NumRows, 
    [In, Optional] ref object NumColumns, 
    [In, Optional] ref object InitialColumnWidth, 
    [In, Optional] ref object Format, 
    [In, Optional] ref object ApplyBorders, 
    [In, Optional] ref object ApplyShading, 
    [In, Optional] ref object ApplyFont, 
    [In, Optional] ref object ApplyColor, 
    [In, Optional] ref object ApplyHeadingRows, 
    [In, Optional] ref object ApplyLastRow, 
    [In, Optional] ref object ApplyFirstColumn, 
    [In, Optional] ref object ApplyLastColumn, 
    [In, Optional] ref object AutoFit, 
    [In, Optional] ref object AutoFitBehavior, 
    [In, Optional] ref object DefaultTableBehavior
);
public: Table^ ConvertToTable(
    &Object^ Separator, 
    &Object^ NumRows, 
    &Object^ NumColumns, 
    &Object^ InitialColumnWidth, 
    &Object^ Format, 
    &Object^ ApplyBorders, 
    &Object^ ApplyShading, 
    &Object^ ApplyFont, 
    &Object^ ApplyColor, 
    &Object^ ApplyHeadingRows, 
    &Object^ ApplyLastRow, 
    &Object^ ApplyFirstColumn, 
    &Object^ ApplyLastColumn, 
    &Object^ AutoFit, 
    &Object^ AutoFitBehavior, 
    &Object^ DefaultTableBehavior
);
public Table ConvertToTable(
    /*in*/System.Object Separator, 
    /*in*/System.Object NumRows, 
    /*in*/System.Object NumColumns, 
    /*in*/System.Object InitialColumnWidth, 
    /*in*/System.Object Format, 
    /*in*/System.Object ApplyBorders, 
    /*in*/System.Object ApplyShading, 
    /*in*/System.Object ApplyFont, 
    /*in*/System.Object ApplyColor, 
    /*in*/System.Object ApplyHeadingRows, 
    /*in*/System.Object ApplyLastRow, 
    /*in*/System.Object ApplyFirstColumn, 
    /*in*/System.Object ApplyLastColumn, 
    /*in*/System.Object AutoFit, 
    /*in*/System.Object AutoFitBehavior, 
    /*in*/System.Object DefaultTableBehavior
);
function ConvertToTable(
     Separator : Object, 
     NumRows : Object, 
     NumColumns : Object, 
     InitialColumnWidth : Object, 
     Format : Object, 
     ApplyBorders : Object, 
     ApplyShading : Object, 
     ApplyFont : Object, 
     ApplyColor : Object, 
     ApplyHeadingRows : Object, 
     ApplyLastRow : Object, 
     ApplyFirstColumn : Object, 
     ApplyLastColumn : Object, 
     AutoFit : Object, 
     AutoFitBehavior : Object, 
     DefaultTableBehavior : Object
) : Table;

Parameters

  • Separator
    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
    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
    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
    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
    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
    Optional Object. True to apply the border properties of the specified format.
  • ApplyShading
    Optional Object. True to apply the shading properties of the specified format.
  • ApplyFont
    Optional Object. True to apply the font properties of the specified format.
  • ApplyColor
    Optional Object. True to apply the color properties of the specified format.
  • ApplyHeadingRows
    Optional Object. True to apply the heading-row properties of the specified format.
  • ApplyLastRow
    Optional Object. True to apply the last-row properties of the specified format.
  • ApplyFirstColumn
    Optional Object. True to apply the first-column properties of the specified format.
  • ApplyLastColumn
    Optional Object. True to apply the last-column properties of the specified format.
  • AutoFit
    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
    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
    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.

Thread Safety

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

Platforms

Development Platforms

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

Target Platforms

See Also

Reference

Range Interface
Microsoft.Office.Interop.Word Namespace

Other Resources

Range Members