Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Spread.Sheets supports AutoFit in columns and rows. AutoFit automatically sizes the column to fit the contents by adjusting the column width or automatically sizes the row to fit the contents by adjusting the row height. You can also include the header text when using AutoFit with the options.autoFitType property.
Double-click the right edge of the column header to resize the column to fit the longest string of text in the column.
Double-click the bottom edge of the row header to resize the row.
You can also select multiple columns or rows or the entire sheet and double-click on one selected column or row to apply AutoFit to all the selected columns or rows.
AutoFit works with hidden columns and rows, filtered columns and rows, grouped columns and rows, and selected columns and rows that are not shown in the viewport. AutoFit is not applied if the resizable method is false for the column or row.
You can also resize the width or height with the autoFitColumn method, autoFitRow method, and the Commands class.

You can enter multiple lines with Alt+Enter if the wordWrap method is true for the cell.

Using Code
This example fits the width of the column to the text.

JavaScript

Copy Code

activeSheet.setValue(0, 1, "testing");activeSheet.autoFitColumn(1);

 

Using Code
This example sets the height of the row to display the text.

JavaScript

Copy Code

activeSheet.setValue(0, 1, "testing\r\nmultiple\r\nlines");activeSheet.getCell(0,1).wordWrap(true);activeSheet.autoFitRow(0);

 

See Also
Workbook Method

  • No labels