私が作成したカスタムテンプレートのベースにExcelファイルを生成するのにxlsx-templateを使用しています。分度器:xlsx-templateエラーが未定義のプロパティ 'length'を読み取ることができません
E/launcher - Cannot read property 'length' of undefined
E/launcher - TypeError: Cannot read property 'length' of undefined at Workbook.module.exports.Workbook.loadSheet (E:\latest-code\latest\test automation\node_modules\xlsx-template\lib\index.js:373:38) at Workbook.module.exports.Workbook.substitute (E:\latest-code\latest\test automation\node_modules\xlsx-template\lib\index.js:123:26) at E:\latest-code\latest\test automation\config\index.js:117:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:416:3)
コードスニペット:
var XlsxTemplate = require('xlsx-template'),
fs = require('fs'),
path = require('path');
describe("excel", function() {
it("excel file", function() {
console.log('inside after each...');
console.log(__dirname);
fs.readFile(path.join(__dirname, 'Template.xlsx'), function(err, data) {
var template = new XlsxTemplate(data);
var values = {
testcase: [{
id: 1,
name: "login",
status: "pass"
}, {
id: 2,
name: "logout",
status: "fail"
}, {
id: 3,
name: "searchbox",
status: "pass"
}]
}
console.log(values);
template.substitute(1, values);
console.log('excel data');
var newData = template.generate();
fs.writeFileSync('test1.xlsx', newData, 'binary');
});
})
私は、他の構成が足りない新しいExcelは、テンプレートの外に
以下ファイル作成はエラーになりながら、しかし、私はエラーを取得していますxlsx-templateの場合私はそれを解決することができないので、このエラーを取り除く方法をアドバイスしてください。
ありがとうございます。
こんにちは。事前に感謝:) – prpa1234