Hide Table of Contents
SetColumnWidth Method (ITableAnnotation)

Sets the width of the specified column in this table.

.NET Syntax

Visual Basic (Declaration) 
Function SetColumnWidth( _
   ByVal Index As System.Integer, _
   ByVal Width As System.Double, _
   ByVal Options As System.Integer _
) As System.Double
Visual Basic (Usage) 
Dim instance As ITableAnnotation
Dim Index As System.Integer
Dim Width As System.Double
Dim Options As System.Integer
Dim value As System.Double
value = instance.SetColumnWidth(Index, Width, Options)
System.double SetColumnWidth( 
   System.int Index,
   System.double Width,
   System.int Options
System.double SetColumnWidth( 
&   System.int Index,
&   System.double Width,
&   System.int Options


Index of column for which to set the width
Width at which to set specified column, in system units

Table's behavior after changing column width as defined by swTableRowColSizeChangeBehavior_e (see Remarks)

Return Value

 Width at which specified column is set (see Remarks)


Index is the column number for which to set the width. Thus, the first column is column 0. It can also be a value from the swTableCellRangeIdentifier_e enumerator.

If Index equals...

Then the width of all of the columns...


Is set, if possible.  


In the current range (see ITableAnnotation::GetCellRange and ITableAnnotation::SetCellRange) is set, if possible.


When the width of a column changes, the rest of the table is affected. The Options argument indicates how the rest of the table should behave.



Options = swTableRowColChange_TableSizeCanChange

The rest of the columns remain the same width and are shifted away from the table anchor to make room for the changed column.

Width of the entire table must remain the same, so that the table continues to fit properly on the drawing

Other columns must absorb the change in width.  There are two possibilities supported by this method.  

  • If Options = swTableRowColChange_AbsorbedByNext, then the first column to the right of the columns whose width has changed, is adjusted if possible. If that is not possible, then the first column to the left of the columns whose width has changed, is adjusted if possible. If that is not possible either, then no action is taken.  

  • The other similar case is if Options = swTableRowColChange_AbsorbedByPrevious. First the column to the left is tried, then the column to the right.

Options = swTableRowColChange_AbsorbedByNext or swTableRowColChange_AbsorbedByPrevious

It may not be possible to get the desired results. If this is the case, you must determine the full width of the table yourself and set row widths individually using the swTableRowColChange_TableSizeCanChange option, making sure to end up with the original table width.

The return value is the width that the column is set to. If you specified a range of columns, it is the width of the first column of that range.

It is possible that the return value is different than the width value that you passed in. One possibility is that if you specify a column width that is less than the minimum column width, the minimum column width is used, instead of what you specified. Another possibility is that if you are trying to maintain a fixed table width, but the width of the adjacent columns is not big enough to absorb the width changes to the columns that you specified, then the return value is the same as the column's original width instead of what you specified.

To get the column width, use ITableAnnotation::GetColumnWidth.

To get or set the row height, use ITableAnnotation::GetRowHeight and ITableAnnotation::SetRowHeight.


See Also


SolidWorks 2004 FCS, Revision Number 12.0

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   SetColumnWidth Method (ITableAnnotation)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2013 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.