From c33b5f8f94fba2373756fb8059d021c336b90129 Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Sat, 8 Jul 2023 12:31:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 8 +++++--- package.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 962ec25..4bbc825 100644 --- a/index.ts +++ b/index.ts @@ -117,6 +117,7 @@ function exportXLSX (params: InterceptorExportParams) { const { $vxe, rowHeight, headerAlign: allHeaderAlign, align: allAlign, footerAlign: allFooterAlign } = $table const { modal, t } = $vxe const { message, sheetName, isHeader, isFooter, isMerge, isColgroup, original, useStyle, sheetMethod } = options + const _isCustomColumn: boolean = (options as any)._isCustomColumn const showMsg = message !== false const mergeCells = $table.getMergeCells() const colList: any[] = [] @@ -162,7 +163,7 @@ function exportXLSX (params: InterceptorExportParams) { beforeRowCount += colList.length } // 处理合并 - if (isMerge) { + if (isMerge && !_isCustomColumn) { mergeCells.forEach(mergeItem => { const { row: mergeRowIndex, rowspan: mergeRowspan, col: mergeColIndex, colspan: mergeColspan } = mergeItem sheetMerges.push({ @@ -185,7 +186,7 @@ function exportXLSX (params: InterceptorExportParams) { const footers = getFooterData(options, footerData) const mergeFooterItems = $table.getMergeFooterItems() // 处理合并 - if (isMerge) { + if (isMerge && !_isCustomColumn) { mergeFooterItems.forEach(mergeItem => { const { row: mergeRowIndex, rowspan: mergeRowspan, col: mergeColIndex, colspan: mergeColspan } = mergeItem sheetMerges.push({ @@ -282,7 +283,8 @@ function exportXLSX (params: InterceptorExportParams) { }) }) } - if (useStyle && sheetMethod) { + // 自定义处理 + if (sheetMethod) { const sParams = { options: options as any, workbook, worksheet: sheet, columns, colgroups, datas, $table } sheetMethod(sParams) } diff --git a/package.json b/package.json index 861aecf..95ef9b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table-plugin-export-xlsx", - "version": "2.2.3", + "version": "2.2.4", "description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式", "scripts": { "lib": "gulp build"