fix : 修复导出表格宽度
This commit is contained in:
@@ -8,7 +8,7 @@ import XLSX from "xlsx-style-vite";
|
||||
* @param columnLength 列长度
|
||||
* @param excelName 导出文件名称
|
||||
*/
|
||||
export function exportExcel($table, columnLength, excelName) {
|
||||
export function exportExcel($table, columnLength, excelName,bigWidth) {
|
||||
//从el-table表生成工作簿对象
|
||||
//使用原始的格式,保留表格中的格式如%、小数末尾的0等
|
||||
let workbook = utils.table_to_book($table, {
|
||||
@@ -16,6 +16,9 @@ export function exportExcel($table, columnLength, excelName) {
|
||||
});
|
||||
//列宽,需要导出的表格有多少列这里的i就小于多少
|
||||
for (let i = 1; i < columnLength; i++) {
|
||||
if(i==bigWidth){
|
||||
workbook.Sheets.Sheet1["!cols"].push({wpx: 300});
|
||||
}
|
||||
workbook.Sheets.Sheet1["!cols"].push({wpx: 100});
|
||||
}
|
||||
//设置单元格样式
|
||||
|
||||
Reference in New Issue
Block a user