最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vue.js - Ag-grid excel export: Multiple hyperlinks in one cell - Stack Overflow

programmeradmin7浏览0评论

I am using vue with ag-grid table, the excel-export feature is not working for the usecase of having multiple links in one cell.

Here is the solution I have now:

const gridOptions = computed(
    (): GridOptions<IOpenQuestion> => ({
        defaultExcelExportParams: {
            autoConvertFormulas: true,
            processCellCallback: params => {
                const { column, value, node } = params;
                const { field, valueFormatter } = column.getColDef();

                if (field === 'documents' && Array.isArray(value) && value.length > 0) {
                    return `=CONCATENATE(${value.map(v => `HYPERLINK("${v?.link}", "${v?.filename}")`).join(', "\n", ')})`;
                }
                return valueFormatter ? valueFormatter({ ...params, data: node.data }) : value;
            },
        },
    }),
);

It currently works if I open the exported file with the Numbers app on mac but with excel it doesn't (only the labels are showing). Is there a way to fix this to have multi-line links within a cell?

发布评论

评论列表(0)

  1. 暂无评论