您可以使用getAutoFitHeight,如果超过最小高度,可以自适应
- for (let r = 0; r < rowCount; r++) {
- var instance = new GC.Spread.Sheets.CellTypes.Text();
- var returnValue = instance.getAutoFitHeight(
- sheet.getValue(r, 3),
- sheet.getText(r, 3),
- sheet.getActualStyle(r, 3),
- sheet.zoom(),
- {"sheet": sheet, "row": r, "col": 3, "sheetArea": GC.Spread.Sheets.SheetArea.viewport});
- if (returnValue > 40) {
- sheet.autoFitRow(r);
- }
- }
复制代码 可以参考附件。
|