Spread Windows Forms 11.0 Product Documentation
Resizing the Data to Fit the Cell
Spread Windows Forms 11.0 Product Documentation > Developer's Guide > Customizing Row, Column, and Cell Appearance > Customizing the Appearance of a Cell > Resizing the Data to Fit the Cell

You can display all the text in the cell with the shrink to fit option. The font size is reduced if the text is too long for the visible area of the cell.

This property is available for the currency, datetime, mask, number, percent, regular expression, text, or general cell.

The following image shows the difference between a cell with the ShrinkToFit property set to True and a cell with the property set to False.

Using Code

  1. Create a cell that supports the shrink to fit option such as the regular expression cell.
  2. Set the ShrinkToFit property.
  3. Set the CellType property.
  4. Type a valid value for the cell such as 11240082777 for the regular expression cell in this example.

Example

This example reduces the font size so the text is displayed in the cell.

C#
Copy Code
FarPoint.Win.Spread.CellType.RegularExpressionCellType testcell = new FarPoint.Win.Spread.CellType.RegularExpressionCellType();
testcell.ShrinkToFit = true;
testcell.RegularExpression = "^\\d{11}$";
fpSpread1.Sheets[0].Cells[0, 0].CellType = testcell;
VB
Copy Code
Dim testcell As New FarPoint.Win.Spread.CellType.RegularExpressionCellType()
testcell.ShrinkToFit = True
testcell.RegularExpression = "^\d{11}$"
fpSpread1.Sheets(0).Cells(0, 0).CellType = testcell

Using the Spread Designer

  1. Select the cell or cells in the work area.
  2. In the property list, in the Misc category, select CellType. From the drop-down list, choose the cell type.
  3. Expand the CellType property and set the ShrinkToFit property to True.
  4. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.
See Also