本帖最后由 lynn512 于 2021-3-30 14:49 编辑
您好,您将临时解决方案代码替换如下,再次测试下:
- isDuplicateName = function (spread, sheet, name) {
- return sheet.getNamedStyle(name) && spread.getNamedStyle(name);
- };
- checkStyle = function (spread, sheet, r, c) { // Rename the style name if sheet and spread both have same name.
- var style = sheet.getStyle(r, c);
- if (style && style.parentName && isDuplicateName(spread, sheet, style.parentName)) {
- style.parentName = sheet.name() + "_" + style.parentName;
- sheet.setStyle(r, c, style);
- //console.log("renamed the use of style name", r, c, sheet.name());
- }
- }
- processNamedStyle = function (spread, sheet) { // Move the sheet namedStyle to spread
- var styles = sheet.getNamedStyles();
- for (var i = 0; i<styles.length; i++) {
- var name = styles[i].name;
- if (isDuplicateName(spread, sheet, name)) {
- styles[i].name = sheet.name() + "_" + name;
- //console.log("renamed the sheet style name", name, sheet.name());
- }
- spread.addNamedStyle(styles[i]);
- sheet.removeNamedStyle(name);
- }
- }
- spread.suspendPaint();
- for(var index = 0; index < spread.sheets.length; index++) {
- var sheet = spread.sheets[index];
- for (var c = 0; c < sheet.getColumnCount(); c++) {
- checkStyle(spread, sheet, -1, c); // column style
- }
- for (var r = 0; r < sheet.getRowCount(); r++) {
- checkStyle(spread, sheet, r, -1); // row style
- for (var c = 0; c < sheet.getColumnCount(); c++) {
- checkStyle(spread, sheet, r, c); // cell style
- }
- }
- processNamedStyle(spread, sheet);
- }
- spread.resumePaint();
复制代码
如果问题仍未解决,我们计划在4月28号发布V14.1.0,建议您在V14.1.0发布后重新测试,看问题能否解决。
|