如何使用p:dataExporter以正确的类型导出数字? [英] How can I export numbers in the correct type using p:dataExporter?

查看:148
本文介绍了如何使用p:dataExporter以正确的类型导出数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PrimeFaces dataExporter 将数据表导出到Excel文件。问题在于数字将导出为文本。

I am using PrimeFaces dataExporter for exporting my datatable to an Excel file. The problem is that numbers are exported as text.

如何将我的数字导出为整数和双精度?

How can I export my numbers as integer and double?

    <p:column headerText="net_usd_sale">
        <h:outputText value="#{dizgi.net_usd_sale}" />
    </p:column>

    <p:column style="text-align: center" exportable="false">
   <f:facet name="header">
     <h:outputText value="Details" />
   </f:facet>
   <h:graphicImage value="/resources/images/details.png"  alt="details image" />

    </p:column>

</p:dataTable>
<h3>Export Page Data Only</h3>
    <h:commandLink>
        <p:graphicImage library="images" name="excel.png" width="24" />
        <p:dataExporter type="xls" target="tbl" fileName="dizgi" pageOnly="true"/>
    </h:commandLink>

    </h:form>

</html>   


推荐答案

可以自定义dataExporter

There is an option to customize your dataExporter

   <h:commandLink id="excel">
    <p:graphicImage name="/demo/images/excel.png" />
    <p:dataExporter type="xls" target="tbl" fileName="cars" 
             postProcessor="#{customizedDocumentsView.postProcessXLS}" />
</h:commandLink>

在后期处理活动中,您可以操纵工作簿。检查此链接 Primefaces DataExporter-定制文档

In post process event you can manipulate your work book. Check this link Primefaces DataExporter - Customized Documents

这篇关于如何使用p:dataExporter以正确的类型导出数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆