<h:outputText value="#{date}" style="display:block; text-align:center">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
Date field exported as number on excel export
I am using Primefaces 13.0.0 with saga theme. When I try to get excel export of datatable, dates become a number . For instance it shows 15102018 instead of 15/08/2018. I had no such problem while using primefaces 11.0.0. What could be the solution ? Thank you in advance.
You need to disable stronglyTypedCells so it doesn't try and format it in Excel. This will make it work like 11.0.0
https://primefaces.github.io/primefaces ... tomization
https://primefaces.github.io/primefaces ... tomization
Code: Select all
excelOpt.setStronglyTypedCells(false);
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
It works now. Thank you for the solution. We have not used data exporter for out project and we have about 250 datatables that uses excel export. So I have to put exporter option to all of them just to set setStronglyTypedCells(false). Is there any way that I can do it as a global setting?Melloware wrote: ↑18 Aug 2023, 16:16You need to disable stronglyTypedCells so it doesn't try and format it in Excel. This will make it work like 11.0.0
https://primefaces.github.io/primefaces ... tomization
Code: Select all
excelOpt.setStronglyTypedCells(false);
Not really unless you create a composite component and replace that exporter with your CC that has it set but my guess is you are still touching 250 tables.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- Information
-
Who is online
Users browsing this forum: No registered users and 15 guests