改一下
src/spreadWrapper/spreadActions.js
[下午5:16] Zhai ChenHui (Brander)
DesignerActionBase.prototype.setStyle = function (attribute, property, value, options, adjustValue, additionArgs) {
var self = this, sheet = self._sheet, spread = self._spread;
options._styles = {}; // prepare object to save related original information
spread.suspendPaint();
self.execInSelectionsForSetStyle(sheet, function (_sheet, row, column) {
var style = _sheet.getStyle(row, column);
if (!style) {
style = new GC.Spread.Sheets.Style();
}
options._styles[self.getKey(row, column)] = style[property]; // save related information, use row, column as the key
if (adjustValue) {
value = adjustValue.apply(self, [_sheet, row, column, style, value].concat(additionArgs || []));
style[property] = value;
_sheet.setStyle(row, column, style);
}
if (["font-size", "font-weight", "font-style"].indexOf(attribute) >= 0) {
self.setFontStyle(style, attribute, value, row, column);
} else if ("font-family" === attribute) {
style.themeFont = keyword_undefined;
var newValue = value;
if (value && value.indexOf("'") === -1 && value.indexOf('"') === -1) {
newValue = '"' + value + '"';
}
self.setFontStyle(style, attribute, newValue, row, column);
} else {
style[property] = value;
_sheet.setStyle(row, column, style);
if (property === 'wordWrap' && !rowHigh[row] && self._sheet.defaults.rowHeight === self._sheet.getRowHeight(row)) {
_sheet.autoFitRow(row);
}
}
});
spread.resumePaint();
};
红色部分是修改的地方
|