Skip to main content

TdxSpreadSheetTableItem.ApplyBestFit Method

Adjusts the size of the table item according to cell content.

Declaration

procedure ApplyBestFit;

Remarks

Call the ApplyBestFit procedure to display cell content in full. The procedure works differently for columns and rows.

Columns

The ApplyBestFit procedure adjusts heights of all populated rows in a column according to cell content.

Rows

The ApplyBestFit procedure adjusts widths of all populated columns in a row according to cell content.

ApplyBestFit may reserve less space than necessary to fit unformatted text when the active worksheet’s Options.ZoomFactor property value differs from 100. This issue may occur because unformatted text is zoomed in steps by standard WinAPI routines, and the ApplyBestFit procedure calculates the target width based on the current zoom factor that can change gradually.

To resolve this issue, you can increase the dxSpreadSheetBestFitWidthCorrectionPercentage global constant value to increase calculated cell widths of all cells that contain unformatted text by a percentage of the corresponding unformatted text lengths. The recommended dxSpreadSheetBestFitWidthCorrectionPercentage global constant value is 2.

Note

Content calculation routines do not rely on font scaling mechanisms of the operating system for formatted text. The dxSpreadSheetBestFitWidthCorrectionPercentage global constant has no effect on cells with RTF content, and the ApplyBestFit procedure always calculates their widths precisely.

See Also