开发者

Richfaces DataTable PDF export

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


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">


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜