使用 NodeJs 我正在尝试使用 Grapecity SpreadJs 库编写一个小型 API。在我的项目中,我安装了以下库:
- "@grapecity/spread-excelio": "^14.2.0",
- "@grapecity/spread-sheets": "^14.1.2",
- "@grapecity/spread-sheets-pdf": "^14.2.0",
- “@grapecity/spread-sheets-print”:“^14.2.0”
当我尝试在 Workbook 实例上调用 savePDF() 时,出现此错误: savePDF() 不是函数。这是我的代码:
GC.Spread.Sheets.LicenseKey = "myKey";
SJSExcel.LicenseKey = "myKey";
var wb = new GC.Spread.Sheets.Workbook();
var invoice = JSON.parse(fs.readFileSync("./invoice_data/invoice_example.json"));
wb.fromJSON(invoice);
wb.savePDF(function (blob) {
var fileName = 'download';
saveAs(blob, fileName + '.pdf');
},
function (error) {
console.log(error);
}
});
怎么了?
提前致谢。