AdjustHeight([MaxHeight: Double = -1;][MinHeight: Double = -1]);
MaxHeight. Maximum row height that can be set when the row is autofit. The -1 value is set by default, in this case maximum height depends on maximum height of range cell contents. The value is indicated in millimeters.
MinHeight. Minimum height of the row, which can be set on autofit. The -1 value is set by default, in this case minimum height depends on minimum height of range cell contents. The value is indicated in millimeters.
The AdjustHeight method automatically adjusts height of range cells to fit cells' contents.
Autofit is performed to to achieve the best fit of contents of all cells in the range. Autofit takes into account font formats, alignment and cell margins. It also depends on values of the MaxHeight and MinHeight parameters that can be defined for this method.
Comment. If text wrap (words by words or syllables by syllables) is set for a range cell, height of all lines contained in the cell is taken into account when automatically adjusting the height. Hyphenation is kept. This can be applied both to single or united cells with the preset text hyphenation.
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: