用户有个需求,说如果从数据库拿出来的数据,然后导出来后,自己修改了数据再次导入到Excel里面,如果当他们导入的不是原来这张表的时候就要阻止导入,所以我想问下有没有这个事件呢?
$("#loadExcel").click(function () {
//spread.suspendPaint();
var excelFile = document.getElementById("fileDemo").files[0];
// here is excel IO API
excelIo.open(excelFile, function (json) {
var workbookObj = json;
spread.fromJSON(workbookObj);
var data = JSON.stringify(workbookObj);
alert((data.indexOf('Yuengh')));
if((data.indexOf('Yuengh'))!=-1){
var sheet = spread.getSheet(1);
for(var i=0;i<sheet.getColumnCount();i++){
if(i==1){
sheet.getRange(0,i,sheet.getRowCount()-1,1).locked(true);
}else{
sheet.getRange(0,i,sheet.getRowCount()-1,1).locked(false);
}
}
sheet.suspendPaint();
sheet.options.allowCellOverflow = true;
var filter = new spreadNS.Filter.HideRowFilter(new spreadNS.Range(1, 0, sheet.getRowCount()-1, sheet.getColumnCount()));
sheet.rowFilter(filter);
sheet.resumePaint();
var option = {
allowFilter: true,
allowSort: true,
allowResizeRows: true,
allowResizeColumns: false,
allowEditObjects: false
};
sheet.options.protectionOptions = option;
sheet.options.isProtected = true;
}else{
alert("请导入系统导出的文件");
return false;
}
}, function (e) {
// process error
alert(e.errorMessage);
if (e.errorCode === 2 /*noPassword*/ || e.errorCode === 3 /*invalidPassword*/) {
}
});
});
求请教,我试过return false是不行的,break好像全都不行,紧求
|
|