SpreadJS provides methods to set the row height and column width to a dynamic size which will auto resize and fill the viewport.
Dynamic sizing, or proportional sizing, is used to make sure that columns and rows completely fill the viewport. When the viewport size is changed or the user adds/deletes/resizes any column or row, the columns/rows that have star sizing applied to them will automatically resize to fill the viewport.
This type of sizing can be used in conjunction with numbers to define a weighted proportion. For example, a column with a star size of "3" would fill 3 times that of a standard "" sized column in the viewport.
Use the setRowHeight and setColumnWidth methods to set the dynamic size.
// The following setting will devide the viewport width with "50%", "30%", "10%", "10%".
sheet.setColumnCount(4, GC.Spread.Sheets.SheetArea.viewport);
sheet.setColumnWidth(0, "5*");
sheet.setColumnWidth(1, "3*");
sheet.setColumnWidth(2, "*");
sheet.setColumnWidth(3, "*");
Use the getRowHeight and getColumnWidth methods can get the actual size and the setting value.
sheet.getColumnWidth(0, GC.Spread.Sheets.SheetArea.viewport); //Get the actual size of column 0. (Get a number)
sheet.getColumnWidth(0, GC.Spread.Sheets.SheetArea.viewport, true); //Get the dynamic size of column 0. (Get a string or undefined)
Submit and view feedback for