我正在实现一个超过65000行的p:dataTable。当我尝试使用p: dataExporter
将其导出到EXCEL时,它会显示以下错误:
java.lang.IllegalArgumentException:外面的行号(65536)无效 允许范围(0..65535)
<p:dataTable id="repFiles" var="rep" value="#{reportFilesBean.list}" filteredValue="#{reportFilesBean.listFiltered}"
paginator="true" rows="20" sortMode="multiple" emptyMessage="Empty result"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="Total: {totalRecords} / Transferred: #{reportFilesBean.countTrans} / Not transferred: #{reportFilesBean.countNotTrans}"
rowsPerPageTemplate="10,20,30,40,50,100" scrollable="true" style="width: 100%;" >
<f:event type="org.primefaces.event.data.PostFilterEvent" listener="#{reportFilesBean.postFilter}" />
<f:facet name="header">
Files transfered
</f:facet>
<p:column sortBy="#{rep.period}" filterBy="#{rep.period}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="Period" />
</f:facet>
<h:outputText value="#{rep.period}" />
</p:column>
<p:column sortBy="#{rep.filename}" filterBy="#{rep.filename}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="Filename" />
</f:facet>
<h:outputText value="#{rep.filename}" />
</p:column>
<p:column sortBy="#{rep.date}" filterBy="#{rep.date}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="Date" />
</f:facet>
<h:outputText value="#{rep.date}" />
</p:column>
</p:dataTable>
<h:commandLink>
<p:graphicImage value="/images/icons/excel-icon.png" title="XLS" />
<p:dataExporter type="xls" target="repFiles" fileName="Reporte_Files_Transferred" />
</h:commandLink>
正如我研究的那样,EXCEL 2003格式最多只支持65535行。但是,当我将p:dataExporter更改为XLSX格式时,它会显示以下错误:
<h:commandLink>
<p:graphicImage value="/images/icons/excel-icon.png" title="XLS" />
<p:dataExporter type="xlsx" target="repFiles" fileName="Reporte_Files_Transferred" />
</h:commandLink>
java.lang.NoClassDefFoundError: 组织/阿帕奇/ POI / XSSF /的usermodel / XSSFWorkbook
我的项目是maven类型,我正在使用: Primefaces 5.3 Primefaces-extensions 4.0 Apache Poi 3.15
非常感谢任何帮助。 提前谢谢。
答案 0 :(得分:0)
Archivo POM添加
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
</dependencies>