- MutipHyperLinkCellType.prototype.paint = function(ctx, value, x, y, w, h, style, context) {
- var hyperStyle = new GC.Spread.Sheets.Style()
- hyperStyle.foreColor = 'black';
- hyperStyle.font = style.font;
- // hyperStyle.cellPadding = '0 0 0 55'
- hyperStyle.textDecoration = GC.Spread.Sheets.TextDecorationType.underline;
-
- var commonStyle = new GC.Spread.Sheets.Style()
- commonStyle.foreColor = 'black';
- commonStyle.font = style.font;
- ctx.font = style.font;
- this._sumItemTextWidth = 0;
- this._itemsTextWidth = [];
- GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, [ctx, value, x, y, w, h, style, context]);
- for (var i = 0; i < this._items.length; i++) {
- var textWidth = parseInt(ctx.measureText(this._items[i]).width.toString()) + 10;
- this._itemsTextWidth.push(textWidth);
- if (i % 2 !== 0) {
- GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this,[ctx, this._items[i], x + this._sumItemTextWidth, y, w, h, hyperStyle, context] )
- } else {
- GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, [ctx, this._items[i], x + this._sumItemTextWidth, y, w, h, commonStyle, context])
- }
- this._sumItemTextWidth += textWidth;
- }
- }
复制代码 参考以上代码,将 渲染单元格value放在 渲染this._items的前面
|