SpreadJS 导入Excel忽略样式但保留条件格式
SpreadJS在导入JSON的时候支持忽略公式或者样式,https://demo.grapecity.com.cn/spreadjs/SpreadJSTutorial/features/workbook/spread-from-json-to-json/purejs忽略样式的同时,条件格式也会被忽略,如果有需求忽略样式但保留条件格式,可参考如下做法。在导入不带样式的内容后,在次从json中导入条件格式。
spread.suspendPaint();
spread.fromJSON(workbookObj, { ignoreStyle: true });
for (var prop in workbookObj.sheets) {
var cSheetJSON = workbookObj.sheets;
if (cSheetJSON.conditionalFormats) {
var sheet = spread.getSheetFromName(cSheetJSON.name);
sheet.conditionalFormats.fromJSON(cSheetJSON.conditionalFormats)
}
}
spread.resumePaint();
页:
[1]