Table of Contents

TExcelFile.SetColWidth Method

Overloads

TExcelFile.SetColWidth(Integer, Integer)

Sets the current Column width, in Excel internal units. (Character width of font 0 / 256) Note: if possible, set many column widths at once by calling SetColWidth(Integer, Integer, Integer). It is faster. See Excel Internal Units for more information in Excel internal units.

Remarks

Use TExcelMetrics.ColMult to convert the internal units to pixels.

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetColWidth(const col: Integer; const width: Integer); overload; virtual; abstract;

Parameters

<-> Parameter Type Description
const col Integer Column index (1 based)
const width Integer Column width, in Excel internal units. (Character width of font 0 / 256). See TExcelMetrics.ColMult

Examples

  ColWidthInPixels := xls.GetColWidth(Col) / TExcelMetrics.ColMult(xls);

See also

TExcelFile.SetColWidth(Integer, Integer, Integer)

Sets the width of a range of columns, in Excel internal units. (Character width of font 0 / 256) See Excel Internal Units for more information in Excel internal units.

Remarks

Use TExcelMetrics.ColMult to convert the internal units to pixels.

Syntax

Unit: FlexCel.Core

procedure TExcelFile.SetColWidth(const col1: Integer; const col2: Integer; const width: Integer); overload; virtual; abstract;

Parameters

<-> Parameter Type Description
const col1 Integer Column index of the first column in the range. (1 based)
const col2 Integer Column index of the last column in the range. (1 based)
const width Integer Column width, in Excel internal units. (Character width of font 0 / 256). See TExcelMetrics.ColMult

Examples

  ColWidthInPixels := xls.GetColWidth(Col) / TExcelMetrics.ColMult(xls);

See also