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"