Here is the code example :
If you are using this jar, 3 points need to be noted :
2. Date format data must have data-date-cell-format attribute
Sample HTML :
https://github.com/callow/html-exporter/blob/master/Sample.html
public static void main(String[] args) throws FileNotFoundException, IOException { String html = IOUtils.toString(new FileInputStream("./Sample.html")); new ExcelExporter().exportHtml(html, new File("./report.xlsx")); }
If you are using this jar, 3 points need to be noted :
1. CSS Style must be defined in the <Style> tag.
<style type="text/css"> .pNewCounter { background: #FFC000; } table, tbody, tfoot, thead, tr, th, td, footer, header { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } </style>
2. Date format data must have data-date-cell-format attribute
<tr> <td>Creation Date</td> <td data-date-cell-format="dd/MM/yyyy">06/08/2018</td> </tr>
3. Text Data must have data-text-cell attribute
<tr> <td>Offer Expiry Date</td> <td data-date-cell-format="dd/MM/yyyy">14/09/2018</td> <td data-date-cell-format="dd/MM/yyyy">14/09/2018</td> </tr> <tr> <td>Offered Amount</td> <td data-text-cell='true' >3,500,000.00</td> <td data-text-cell='true' ><strong>3,600,000.00</strong></td> </tr> <tr> <td>Offered Amount (%) </td> <td data-text-cell='true' >35.000%</td> <td data-text-cell='true'><strong>36.000%</strong></td> </tr>
Sample HTML :
https://github.com/callow/html-exporter/blob/master/Sample.html
No comments:
Post a Comment