尝试设置
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>