Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the that i wrote before and working case ; </p> <p>xhtml ; </p> <pre><code>&lt;h:panelGrid id="viewCommand" style="float:right;" &gt; &lt;p:commandButton value="Export Excel" icon="ui-icon-document" ajax="false" actionListener="#{xxx.export2Excel}" rendered="#{xxx.showTable}"&gt; &lt;p:fileDownload value="#{xxx.exportFile}" contentDisposition="attachment" /&gt; &lt;/p:commandButton&gt;&lt;/h:panelGrid&gt; </code></pre> <p>Java side(with POI) ; </p> <pre><code>protected void lOBExport2Excel(List table) throws Throwable { Row row = null; Cell cell = null; try { Workbook wb = new HSSFWorkbook(); HSSFCellStyle styleHeader = (HSSFCellStyle) wb.createCellStyle(); HSSFFont fontHeader = (HSSFFont) wb.createFont(); fontHeader.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); styleHeader.setFont(fontHeader); Sheet sheet = wb.createSheet("sheet"); row = sheet.createRow((short) 0); for (int i = 0; i &lt; columnNames.size(); i++) { cell = row.createCell(i); cell.setCellValue(columnNames.get(i)); cell.setCellStyle(styleHeader); } int j = 1; for (DBData[] temp : tabularData) { row = sheet.createRow((short) j); for (int k = 0; k &lt; temp.length; k++) { HSSFCellStyle styleRow = (HSSFCellStyle) wb.createCellStyle(); HSSFFont fontRow = (HSSFFont) wb.createFont(); fontRow.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); styleRow.setFont(fontRow); cell = row.createCell(k); setStyleFormat(temp[k].getDataType(), styleRow, wb); cell.setCellValue(temp[k].toFullString()); cell.setCellStyle(styleRow); } j++; } String excelFileName = getFileName("xls"); FileOutputStream fos = new FileOutputStream(excelFileName); wb.write(fos); fos.flush(); fos.close(); InputStream stream = new BufferedInputStream(new FileInputStream(excelFileName)); exportFile = new DefaultStreamedContent(stream, "application/xls", excelFileName); } catch (Exception e) { catchError(e); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload