开启行列转换时,忽略header图标,导出excel第一列异常
Open
Nobody has claimed this yet.
good first issue
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 486
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 16
Description
@visactor/vtable : 1.18.4
@visactor/vtable-export: 1.18.4
import { ListTable, TYPES } from '@visactor/vtable'
import type { ColumnDefine as VColumnDefine } from '@visactor/vtable'
// 使用时需要引入插件包@visactor/vtable-export
import {
downloadExcel,
exportVTableToExcel,
} from '@visactor/vtable-export'
VTable.register.icon('filter', {
name: 'filter',
type: 'svg',
width: 14,
height: 14,
marginRight: 0,
cursor: 'pointer',
hover: {
bgColor: 'rgba(238,244,246,0.5)',
width: 22,
height: 22,
},
positionType: VTable.TYPES.IconPosition.right,
// interactive: true,
svg: '<svg x="1707378931406" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1587" width="200" height="200"><path d="M741.248 79.68l-234.112 350.08v551.488l55.296 24.704v-555.776l249.152-372.544c8.064-32.96-10.496-59.712-41.152-59.712h-709.248c-30.464 0-49.28 26.752-41.344 59.712l265.728 372.544v432.256l55.36 24.704v-478.592l-248.896-348.864h649.216z m-68.032 339.648c0-16.832 12.096-30.592 27.264-30.848h277.888c15.232 0 27.712 13.824 27.712 30.848s-12.416 30.848-27.712 30.848h-277.888c-15.168-0.32-27.264-14.016-27.264-30.848z m0 185.216c0-16.832 12.096-30.592 27.264-30.848h277.888c15.232 0 27.712 13.824 27.712 30.848s-12.416 30.848-27.712 30.848h-277.888c-15.168-0.256-27.264-14.016-27.264-30.848z m0 185.28c0-16.832 12.096-30.592 27.264-30.848h277.888c15.232 0 27.712 13.824 27.712 30.848s-12.416 30.848-27.712 30.848h-277.888c-15.168-0.32-27.264-13.952-27.264-30.848z" p-id="1588"></path></svg>',
})
VTable.register.icon('filtered', {
name: 'filtered',
type: 'svg',
width: 14,
height: 14,
marginRight: 0,
cursor: 'pointer',
hover: {
bgColor: 'rgba(238,244,246,0.5)',
width: 22,
height: 22,
},
positionType: VTable.TYPES.IconPosition.right,
// interactive: true,
svg: '<svg x="1707378931406" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1587" width="200" height="200"><path d="M741.248 79.68l-234.112 350.08v551.488l55.296 24.704v-555.776l249.152-372.544c8.064-32.96-10.496-59.712-41.152-59.712h-709.248c-30.464 0-49.28 26.752-41.344 59.712l265.728 372.544v432.256l55.36 24.704v-478.592l-248.896-348.864h649.216z m-68.032 339.648c0-16.832 12.096-30.592 27.264-30.848h277.888c15.232 0 27.712 13.824 27.712 30.848s-12.416 30.848-27.712 30.848h-277.888c-15.168-0.32-27.264-14.016-27.264-30.848z m0 185.216c0-16.832 12.096-30.592 27.264-30.848h277.888c15.232 0 27.712 13.824 27.712 30.848s-12.416 30.848-27.712 30.848h-277.888c-15.168-0.256-27.264-14.016-27.264-30.848z m0 185.28c0-16.832 12.096-30.592 27.264-30.848h277.888c15.232 0 27.712 13.824 27.712 30.848s-12.416 30.848-27.712 30.848h-277.888c-15.168-0.32-27.264-13.952-27.264-30.848z" p-id="1588" fill="#1890ff"></path></svg>',
})
const columns: ColumnsDefine = rawColumns.map((column, index) => {
return {
cellType: 'text',
field: `field${index}`,
title: column.name,
width: 'auto',
headerIcon: 'filter',
filter: '*',
sort: (a, b, order): CompareResult => {
// 定义排序方法
},
}
})
const isTranspose = ref(false) // 是否转置表格数据,(行列转换)
const excelData = await exportVTableToExcel(tableInstance.value, {
ignoreIcon: !isTranspose.value, //这里不忽略icon可以正常导出,不进行转换时忽略icon也可以正常导出
})
await downloadExcel(excelData, fileName)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided reproduction and trace exportVTableToExcel in @visactor/vtable-export, focusing on transpose handling and the ignoreIcon option; downloadExcel is the final export step. Verify the generated Excel output with header icons and transposed data, and confirm that the first column is correct in both ignoreIcon configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100