Hi Sakthivel,

I introduced the screenxls type screen to use the spread software
functionality to convert a html table to spread table with possibility
to indicate the cell format.
So you can use screencsv if you not need format and screenxls if you
need format.
If you need to export are native xlsx format as unofficial plugins we
develop a XlsUtil class [1] to convert a screenxls to native xlsx with a
new view type : "exportxls"

****

    <handler name="exportxls" type="view"
class="com.nereide.webapp.ExportXlsViewHandler"/>
    <view-map name="MyCatalogList.xlsx"
page="component://myplugin/widget/myplugins/ExportScreens.xml#DownloadMyCatalogList"
type="exportxls" content-type="application/msexcel" encoding="UTF-8"/>
****
You can use it as you want for your case.

An others solution also is create your how Handler to create your export
with Apache POI [2] :

*****

Workbook workbook = new XSSFWorkbook(); [...]

response.setContentType(contentType); OutputStream outputStream = 
response.getOutputStream(); workbook.write(outputStream); outputStream.flush();

*****

Let me know if you found your happiness!
Cheers,
Nicolas

[1] https://labs.nereide.fr/10031/plugins/nereideutils/

[2] https://poi.apache.org/

On 02/09/2020 22:08, Sakthivel Vellingiri wrote:
> All, Does Ofbiz support Excel export natively? i see most of the Out of the
> box exports are using .csv.instead, however i do see an Excel sample in the
> Example plugin and below is the url to the Ofbiz instance running locally
> It uses the view-map type as "screenxls", but when the export is complete
> it does not produce an xls file rather it produces a html response; It may
> not be a big deal as .csv works as expected and .csv could be saved as .xls
> or .xlsx, But wanted to check with the community if there is anything
> missed in the Excel Export to function natively; Thanks for any pointers.
>
>     <view-map name="ExampleReportXls" type="screenxls"
> page="component://example/widget/example/ExampleScreens.xml#ExampleReport"
> content-type="application/vnd.ms-excel"/>
> https://localhost:9443/example/control/EditExample?exampleId=EX01
>
> <!-- Begin Template
> component://common-theme/template/includes/Simple.xls.ftl -->
>
> <html lang="en-US" dir="ltr" xmlns="http://www.w3.org/1999/xhtml";>
>   <head>
>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
>   </head>
>
>   <body>
>     <style>
>         .txf {
>             mso-number-format: \@
>         }
>
>         .cf {
>             mso-number-format: "\#\#0.00"
>         }
>
>         .nf {
>             mso-number-format: "0.00"
>         }
>
>         .tf {
>             mso-number-format: "HH:mm:ss"
>         }
>
>         .df {
>             mso-number-format: "yyyy-MM-dd"
>         }
>
>         .dtf {
>             mso-number-format: "yyyy-MM-dd HH:mm:ss"
>         }
>     </style>
>     <table><tr>
> <td class="txf" >Example ID</td><td class="txf" >EX01</td></tr>
> <tr>
> <td class="txf" >Type</td><td class="txf" required>Contrived</td></tr>
> <tr>
> <td class="txf" >Status</td><td class="txf" required>In Design</td></tr>
> <tr>
> <td class="txf" >Example Name</td><td class="txf" required>Example 1</td></tr>
> <tr>
> <td class="txf" >Description</td><td class="txf" ></td></tr>
> <tr>
> <td class="txf" >Long Description</td></tr>
> <tr>
> <td class="txf" >Comments</td><td class="txf" ></td></tr>
> <tr>
> <td class="txf" >Example Size</td><td class="txf" ></td></tr>
> <tr>
> <td class="txf" >Example Date</td><td class="dtf" ></td></tr>
> <tr>
> <td class="txf" >Another Date</td><td class="dtf" ></td></tr>
> <tr>
> <td class="txf" >Another Text</td><td class="txf" ></td></tr>
> <tr>
> <td class="txf" ></td></tr>
> </table>
>   </body>
> </html>
> <!-- End Template component://common-theme/template/includes/Simple.xls.ftl 
> -->
>

Attachment: pEpkey.asc
Description: application/pgp-keys

Attachment: pEpkey.asc
Description: application/pgp-keys

Reply via email to