优化导出

This commit is contained in:
xuliangzhan
2023-07-08 14:10:47 +08:00
parent 05c3679309
commit f867b8e33b
2 changed files with 7 additions and 5 deletions

View File

@@ -119,6 +119,7 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
const { headerAlign: allHeaderAlign, align: allAlign, footerAlign: allFooterAlign } = props
const { rowHeight } = reactData
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[] = []
@@ -164,7 +165,7 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
beforeRowCount += colList.length
}
// 处理合并
if (isMerge) {
if (isMerge && !_isCustomColumn) {
mergeCells.forEach(mergeItem => {
const { row: mergeRowIndex, rowspan: mergeRowspan, col: mergeColIndex, colspan: mergeColspan } = mergeItem
sheetMerges.push({
@@ -187,7 +188,7 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.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({
@@ -288,7 +289,8 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
})
})
}
if (useStyle && sheetMethod) {
// 自定义处理
if (sheetMethod) {
sheetMethod({ options: options, workbook, worksheet: sheet, columns, colgroups, datas, $table })
}
sheetMerges.forEach(({ s, e }) => {

View File

@@ -1,6 +1,6 @@
{
"name": "vxe-table-plugin-export-xlsx",
"version": "3.0.5",
"version": "3.0.7",
"description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式",
"scripts": {
"lib": "gulp build"
@@ -50,7 +50,7 @@
"sass": "^1.55.0",
"typescript": "^4.6.4",
"vue": "^3.3.4",
"vxe-table": "^4.4.5",
"vxe-table": "^4.4.6",
"xe-utils": "^3.5.11"
},
"peerDependencies": {