SSGetMaxTextCellSize Function
Applies To
fpSpread DLL control
Description
Returns the minimum height and width of the specified cell necessary to display all the text within the cell.
Syntax
BOOL SSGetMaxTextCellSize(HWND hWnd, SS_COORD Col, SS_COORD Row, LPDOUBLE lpdfWidth, LPDOUBLE lpdfHeight);
BOOL TSpread::GetMaxTextCellSize(SS_COORD Col, SS_COORD Row, LPDOUBLE lpdfWidth, LPDOUBLE lpdfHeight);
Parameters
This function has the following parameters:
Parameter | Description |
---|---|
hWnd | Window handle of the fpSpread control |
Col | Column number of cell |
Row | Row number of cell |
lpdfWidth | Pointer to variable that receives text width (Value is in sheet coordinates.) |
lpdfHeight | Pointer to variable that receives text height (Value is in sheet coordinates.) |
Remarks
This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.
Cells that display multiple lines of text return only the text height. That is, the text height is returned in the lpdfWidth parameter. The text width is not returned.
You can pass the returned values to the SSSetColWidth and SSSetRowHeight functions to change the column width and row height to reflect the cell text length and height.
For static text or edit cells, the lpdfWidth and lpdfHeight values returned vary according to the parameter settings described in the following table:
Function | Parameter | Constant | lpdfHeight Value Returned | lpdfWidth Value Returned |
---|---|---|---|---|
SSSetTypeEdit (edit cell) |
Style | ES_MULTILINE included | The minimum row height necessary to display all the text in the cell given the current column width and font size | The current column width |
ES_MULTILINE not included | The minimum row height necessary to display one line of text given the current font size | The minimum cell width necessary to display the entire line of text with no word wrap given the current font size | ||
SSSetTypeStaticText (static text cell) | TextStyle | SS_TEXT_WORDWRAP included | The minimum row height necessary to display all the text in the cell given the current column width and font size | The current column width |
SS_TEXT_WORDWRAP not included | The minimum row height necessary to display one line of text given the current font size | The minimum cell width necessary to display the entire line of text with no word wrap given the current font size |
Note: By default, text wraps in header cells and does not wrap in cells in the body of the sheet. |
Return Value
TRUE if the function completes successfully; FALSE otherwise.
See Also
Resizing a Cell to Fit the Tallest Data
Resizing a Cell to Fit the Widest Data
SSGetMaxTextColWidth, SSGetMaxTextRowHeight, SSSetColWidth, SSSetRowHeight, SSSetSheet, SSSetTypeEdit, SSSetTypeStaticText functions
ActiveX Correspondence
MaxTextCellHeight, MaxTextCellWidth properties