ITabRange.AdjustWidth

Syntax

AdjustWidth([MaxWidth: Double = -1;][MinWidth: Double = -1]);

Parameters

MaxWidth. Maximum column height that can be set when the column is autofit. The -1 value is set by default, in this case maximum width depends on maximum width of range cell contents. The value is indicated in millimeters.

MinWidth. Minimum column width that can be set during autofit. The -1 value is set by default, minimum width depends on minimum width of range cell contents. The value is indicated in millimeters.

Description

The AdjustWidth method automatically adjusts width of range columns to fit cells contents.

Comments

Autofit must display entire content of all cells in the range. Font format, alignment, and cell margins are taken into account. Values of the MaxHeight and MinHeight parameters that can be defined for this method should be also considered.

Comment. If text wrapping (words or syllables) is enabled for a range cell, width of all columns contained in the cell is taken into account when automatically adjusting the width. Hyphenation is kept. This can be applied both to single or united cells with the preset text hyphenation.

Example

Executing the example requires a form, a button on the form, the TabSheetBox component named TabSheetBox1, and a data source for this component. The A0 table cell contains data.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Tab: ITabSheet;
    Range: ITabRange;
Begin
    Tab := TabSheetBox1.Source.GetTabSheet;
    Range := Tab.ParseCell("A0");
    Range.AdjustHeight;
    Range.AdjustWidth;
End Sub Button1OnClick;

Clicking the button automatically autofits height and width of rows and columns according to A0 cell contents.

Source data cell:

Example execution result:

See also:

ITabRange