我需要以表格格式显示非结构化excel数据以及空格
现在我正在显示表中的非结构化数据,但是它没有在列中占用空间,表也以非结构化格式显示
onFileChange(ev) {
let workBook = null;
let jsonData = null;
const reader = new FileReader();
const file = ev.target.files[0];
reader.onload = (event) => {
const data = reader.result;
workBook = XLSX.read(data, { type: 'binary' });
jsonData = workBook.SheetNames.reduce((initial, name) => {
const sheet = workBook.Sheets[name];
initial[name] = XLSX.utils.sheet_to_json(sheet);
return initial;
}, {});
this.columnsArr = [];
this.data = Object.keys(jsonData).map(key=>jsonData[key])
console.log(this.data);
this.data.forEach((elm, index) => {
this.item = elm;
for (var firstKey in this.item[0]) break;
this.emtKey = firstKey;
});
// this.output = dataString.slice(0, 300);
// this.setDownload(dataString);
}
reader.readAsBinaryString(file);
}
我需要显示与Excel工作表数据相同的表