SpreadJS Documentation
Using Shrink to Fit
SpreadJS Documentation > Developer's Guide > Managing the User Interface > 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 method to false.

Using Code

This example sets the shrinkToFit method.

JavaScript
Copy Code
activeSheet.getCell(1,1).shrinkToFit(true);
activeSheet.getCell(1,1).text("Shrink To Fit Test");
activeSheet.getCell(2,1).shrinkToFit(false);
activeSheet.getCell(2,1).text("Shrink To Fit Test");
See Also