Using Shrink to Fit

The shrink to fit feature attempts to display all the text in the cell. The font size is reduced if the text is too long for the visible area of the cell.

The following image shows the difference between a cell that supports shrink to fit and a cell that does not. Cell B2 supports the shrink to fit option. Cell B3 sets the ShrinkToFit property to false.

Using Code

This example sets the ShrinkToFit property.

CS
Copy Code
gcSpreadSheet1.Sheets[0].Cells[1, 1].Text = "Shrink To Fit Test";
gcSpreadSheet1.Sheets[0].Cells[1, 1].ShrinkToFit = true;
gcSpreadSheet1.Sheets[0].Cells[2, 1].Text = "Shrink To Fit Test";
gcSpreadSheet1.Sheets[0].Cells[2, 1].ShrinkToFit = false;
VB
Copy Code
GcSpreadSheet1.Sheets(0).Cells(1,1).Text = "Shrink To Fit Test"
GcSpreadSheet1.Sheets(0).Cells(1,1).ShrinkToFit = True
GcSpreadSheet1.Sheets(0).Cells(2,1).Text = "Shrink To Fit Test"
GcSpreadSheet1.Sheets(0).Cells(2,1).ShrinkToFit = False
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.