您可以用下面的代码判断单元格文本长度- var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
- var sheet = spread.getActiveSheet();
- sheet.setValue(0,0,"TEST TEXT LENGTH");
- var instance = new GC.Spread.Sheets.CellTypes.Text();
- var returnValue = instance.getAutoFitWidth(
- sheet.getValue(0,0), sheet.getText(0,0), sheet.getActualStyle(0,0), sheet.zoom(), {
- "sheet":sheet,
- "row":0,
- "col":0,
- "sheetArea":GC.Spread.Sheets.SheetArea.viewport
- }
- );
- alert(returnValue);
复制代码 与列宽之间的关系,大于列宽则溢出
|