Posted 1 November 2017, 11:46 am EST
function IOCellType() {GC.Spread.Sheets.CellTypes.Text.call(this);}
// IOCellType.prototype = new $.wijmo.wijspread.TextCellType();
IOCellType.prototype = GC.Spread.Sheets.CellTypes.Text();
IOCellType.prototype.paint = function(ctx, value, x, y, w, h, style, context) {
var cellMode = ViewModeService.getCurrentViewMode().name;
var sheet = context.sheet;
var tag = sheet.getCell(context.row, context.col, GC.Spread.Sheets.SheetArea.viewport, true).tag();
if (tag) {
if (cellMode === "INPUT" && tag.inputMapping !== null) {
value = tag.inputMapping;
}
if (cellMode === "OUTPUT" && tag.outputMapping !== null) {
value = tag.outputMapping;
}
if (cellMode === "FORMULA" && tag.text !== null) {
value = tag.text;
}
}
// $.wijmo.wijspread.TextCellType.prototype.paint.apply(this, [ctx, value, x, y, w, h, style, context]);
GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, [ctx, value, x, y, w, h, style, context]);
if (tag && cellMode !== "TEST") {
if (tag.inputMapping) {
ctx.fillStyle = "red";
ctx.beginPath();
ctx.moveTo(x + w - 12, y);
ctx.lineTo(x + w, y);
ctx.lineTo(x + w, y + 12);
ctx.closePath();
ctx.fill();
}
if (tag.outputMapping) {
ctx.fillStyle = "green";
ctx.beginPath();
ctx.moveTo(x, y + h - 12);
ctx.lineTo(x, y + h);
ctx.lineTo(x + 12, y + h);
ctx.closePath();
ctx.fill();
}
if (tag.text) {
ctx.fillStyle = "blue";
ctx.beginPath();
ctx.moveTo(x, y + h - 10);
ctx.lineTo(x, y + h);
ctx.lineTo(x + 10, y + h);
ctx.closePath();
ctx.fill();
ctx.beginPath();
ctx.moveTo(x + w - 10, y);
ctx.lineTo(x + w, y);
ctx.lineTo(x + w, y + 10);
ctx.closePath();
ctx.fill();
}
}
};
when I run this code, I can get such error.
TypeError: Cannot set property ‘paint’ of undefined.
How can I fix this error?
I followed only this code.
http://help.grapecity.com/spread/SpreadSheets10/webframe.html#cellcustom.html
Pls help me.
Thanks.