本帖最后由 辉0451 于 2024-10-21 14:44 编辑
//定义文件保存点击命令
let loadFileExecute = {
iconClass:"file-load",
text:"文件保存",
commandName:"loadFile",
execute:async(context) => {
const userInput = prompt("请输入文件名称:");
var json = spread.toJSON({includeBindingSource: true});
var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API
excelIo.save(json, function (blob) {
var fd = new FormData(document.forms.namedItem("myform"));
fd.append("test.xlsx", blob);
$.ajax({
url: ctxPATH + "/mfkdbpivotsource.do?method=saveFile",
type: "POST",
contentType: false,
processData: false,
data: fd,
success: function (data) {
if (data.isSuccess == 1) {
alert("上传成功!");
} else {
alert(data.errorMessage);
}
},
error: function (ex) {
alert("上传失败:" + ex);
}
});
}, function (e) {
console.log(e);
});
}
} |