我正在为我的一个小项目使用Seam 2.2.1
。我知道有一个针对 richfaces:dataTable
的 Excel 导出功能,但是 PDF 也有类似的功能吗?我真的不想用 iText
编写 PDF 导出。
问候
最佳答案
您可以使用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">
关于java - Richfaces 数据表 PDF 导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4119144/