Richfaces DataTable PDF export

谁都会走 提交于 2019-12-24 05:36:04

问题


I'm using Seam 2.2.1 for a little project of mine. I know there is a excel export for richfaces:dataTable but is there something like this for PDFs too? I don't really want to write a PDF export with iText.

Regards


回答1:


You can easily export the generated HTML to PDF with Seam PDF

It does use iText internally, but you don't have to write any iText code.

Create a link that takes the same List you are using iterate the RichFaces datatable.

<p:table  columns="2" headerRows="1" widthPercentage="95" widths="0.5 0.5" spacingBefore="10">
    <p:cell backgroundColor="#EEEEEE">#{messages['notes.description']}</p:cell>
    <p:cell backgroundColor="#EEEEEE">#{messages['notes.processUserName']}</p:cell>
    <ui:repeat var="note" value="#{yourListHere}">
        <p:cell>#{note.description}</p:cell>
        <p:cell>#{note.processUserName}</p:cell>
    </ui:repeat>
</p:table>

Something like this. Remember to wrap everything inside a

<p:document xmlns:p="http://jboss.com/products/seam/pdf">



回答2:


If you don't insist on using <rich:dataTable>, you can try <p:dataTable> (primefaces) which has built-in export for PDF. See here

Otherwise you can use JasperReports for easier, GUI design of your exported PDF.



来源:https://stackoverflow.com/questions/4119144/richfaces-datatable-pdf-export

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!