Xceed Words for .NET v5.0 Documentation
Xceed.Document.NET Assembly / Xceed.Document.NET Namespace / Table Class / SetWidths Method
The array of widths to set (one entry per column, in points).
true to fix the columns width. When false, adding new columns may reduce all column's width to fit on page.


In This Topic
    SetWidths Method
    In This Topic
    Sets the widths of this Table's columns (in points).
    Syntax
    'Declaration
     
    Public Sub SetWidths( _
       ByVal widths() As Single, _
       Optional ByVal fixWidths As Boolean _
    ) 
    'Usage
     
    Dim instance As Table
    Dim widths() As Single
    Dim fixWidths As Boolean
     
    instance.SetWidths(widths, fixWidths)
    public void SetWidths( 
       float[] widths,
       bool fixWidths
    )

    Parameters

    widths
    The array of widths to set (one entry per column, in points).
    fixWidths
    true to fix the columns width. When false, adding new columns may reduce all column's width to fit on page.
    Remarks

    This method expects values expressed in points (pt).

    • To convert to 20th of a point (dxa) : pt*20
    • To convert to Inches (in) : pt*72
    • To convert to Centimeters (cm) : in*2.54

    When the Table.AutoFit property is set to "Fixed", the columns' widths from the array parameter will be applied as is.

    When the Table.AutoFit property is not set to "Fixed", the columns' widths from the array parameter will be applied as is, except if the total width received exceeds the page's available space. In this situation, a ratio is calculated to adjust the columns' widths from the array parameter to fit on the page.

    Example

    The following examples assume that the page size is 450 pts.

    1) table.SetWidths( new float[] { 100f, 100, 200f } );
    The resulting columns' sizes will be 100, 100 and 200, because the total width of the array (400) is smaller than the page size (450).

    2) table.SetWidths( new float[] { 200f, 100, 300f } );
    The resulting columns' sizes will be 150 (200/600*450), 75 (100/600*450) and 225 (300/600*450), because the total width of the array (600) is greater than the page size (450).

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows, 11, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also