本帖最后由 llaysz 于 2019-6-10 14:38 编辑
自定义部分如下,我使用的版本是11.1.4,问题描述,当把这个定义设置给单元格以后保存模板重新加载的时候需要鼠标移动的列头触发鼠标事件或者改变窗口大小后才能绘制出图片来,请帮我看看是我的实现哪有问题吗,就如截图的效果var spreadNS = GC.Spread.Sheets; var customCellTypes = customCellTypes || {}
function paitImage(imgUrl, myctx, x, y, w, h){
function drawBeauty(beauty){
myctx.drawImage(beauty, x, y, w, h);
}
var beauty = new Image();
beauty.src = imgUrl;
if(beauty.complete){
drawBeauty(beauty);
}else{
beauty.onload = function(){
drawBeauty(beauty);
};
beauty.onerror = function(){
};
}
}
customCellTypes.FileCellType = function() {
this.typeName = "customCellTypes.FileCellType";
}
customCellTypes.FileCellType.prototype = new spreadNS.CellTypes.Base();
customCellTypes.FileCellType.prototype.isImeAware = function (context) {
return false;
}
customCellTypes.FileCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
var url = "http://localhost:8090/portal/userfiles/dd6c3314-46bd-4427-9fdd-02049be9e32b.jpg";
paitImage( url, ctx, x, y, w, h);
};
|
|