Richfaces DataTable PDF导出

时间:2010-11-07 18:52:10

标签: java pdf export seam

我正在使用Seam 2.2.1作为我的一个小项目。我知道richfaces:dataTable有一个excel导出,但对于PDF也有这样的东西吗?我真的不想用iText编写PDF导出。

此致

2 个答案:

答案 0 :(得分:2)

您可以使用Seam PDF

轻松将生成的HTML导出为PDF

它在内部使用iText,但您不必编写任何iText代码。

创建一个链接,该链接使用您使用的相同列表迭代RichFaces数据表。

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

像这样的东西。 记得将所有内容都包装在

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

答案 1 :(得分:1)

如果您不坚持使用<rich:dataTable>,则可以尝试使用内置PDF导出的<p:dataTable>(primefaces)。见here

否则,您可以使用JasperReports更轻松地设计导出的PDF文件。

相关问题