当其中一列仅包含unicode数字时,无法导出数据表

问题描述 投票:0回答:1
jsf primefaces export-to-excel primefaces-dataexporter
1个回答
0
投票

尝试设置

setStronglyTypedCells(false);
,这不会尝试为 Excel 翻译数字。

https://primefaces.github.io/primefaces/11_0_0/#/components/dataexporter?id=customization

public class CustomizedDocumentsView implements Serializable {
    private ExcelOptions excelOpt;

    @PostConstruct
    public void init() {
        excelOpt = new ExcelOptions();
        excelOpt.setStronglyTypedCells(false);
    }
    public ExcelOptions getExcelOpt() {
        return excelOpt;
    }
}
<h:commandButton value="Export as XLS">
    <p:dataExporter type="xls" target="tableId" fileName="cars" options="#{customizedDocumentsView.excelOpt}"/>
</h:commandButton>
© www.soinside.com 2019 - 2024. All rights reserved.