本帖最后由 前端小菜鸟 于 2023-3-29 14:39 编辑
我的导出处理是这样的
我的excel里面原本是显示分页信息和打印信息的,但是导出之后没有了
另外的导入的excel模板里面有显示‘第一页第二页’这样的字,导入到系统里面之后就没有字了这么设置呢?
有类似isPrintLineVisible(true) 这样的方法 专门去显示第几页这样的字的设置么?
export() {
let json = this.spread.toJSON();
this.spreadCopy = new GC.Spread.Sheets.Workbook();
this.spreadCopy.fromJSON(json,{ignoreFormula: true,ignoreStyle: false});//先取消公式再删除,否则出错
this.spreadCopy.suspendPaint();
for (let index = 0; index < 26; index++) {
this.spreadCopy.removeSheet(0);
}
for (let index = 0; index < this.spreadCopy.getSheetCount(); index++) {
let sheet = this.spreadCopy.getSheet(index);
sheet.isPrintLineVisible(true)
}
this.spreadCopy.resumePaint();
let jsonCopy = this.spreadCopy.toJSON({ignoreStyle: false,includeBindingSource: true,saveAsView: true});
let excelIo = new Excel.IO();
let fileNames = this.record.case_name + '.xlsx'
excelIo.save(jsonCopy, (blob) => {
this.sharedimpservice.downloadContent(blob, fileNames);
}, (e) => {
this.msg.error(e)
});
}
downloadContent(content, fileName?: string) {
let eleLink = document.createElement('a');
eleLink.download = fileName || '下载.xlsx';
eleLink.style.display = 'none';
const blob = new Blob([content]);
eleLink.href = URL.createObjectURL(blob);
document.body.appendChild(eleLink);
eleLink.click();
document.body.removeChild(eleLink);
return;
}
|