问题描述
我已经安装了xlsx模块并导入了用于在角度下载Excel。
private exportToExcel = (tableId):void=>{
/*name of the excel-file which will be downloaded. */
let fileName= 'PendingTransactionDueForrenewal.xlsx';
/* table id is passed over here */
let element = document.getElementById(tableId);
const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(element);
/* generate workbook and add the worksheet */
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb,ws,'PendingTransactionDueForrenewal');
/* Set the column width */
var wscols = [
{wch:50},{wch:50},{wch:100}
];
ws['!cols'] = wscols;
wb.Sheets["PendingTransactionDueForrenewal"] = ws;
/* save to file */
XLSX.writeFile(wb,fileName);
}
我可以运行下载带有数据的excel表格。但是,在将代码签入GIT之后,Bamboo将为功能分支进行自动构建,并因以下错误而使构建失败:
未找到模块:错误:无法解析'E:\ bamboo \ agent_1 \ xml-data \ build-dir \ EP2-EP2UI566-BUILDJOB \ app \ src \ app \ core \ module \ product \中的'xlsx' \
webpack.common.js:
'xlsx.shared.js': [
'node_modules/xlsx/dist/xlsx.js',],
index.html:
<script rel="preload" src="./xlsx.shared.js" as="script"></script>
enviornment.ts:
config.json:
竹节错误:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)