SpreadJS 14
Features / Cells / Shrink to Fit
In This Topic
    Shrink to Fit
    In This Topic

    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.

    Cell supporting shrink to fit and a cell that does not

    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