我正在尝试使用primeface p:dataTable
组件
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = context.getViewRoot();
UIComponent component = viewRoot.findComponent(":formName:dataTableName");
DataTable tableX = (DataTable) component;
exporter.export(context,
tableX,
tempFile.getName(), // I created a Temp file using File.createTempFile
false, false, "UTF-8",
null, null);
context.responseComplete();
你能帮我找到这段代码的错误吗?为什么excel文件的大小是0KB?
非常感谢!
答案 0 :(得分:0)
在primefaces中使用xls Exporter标记。
<p:dataExporter type="xls" target="tablename" fileName="your filename" />