Date field exported as number on excel export

UI Components for JSF
Post Reply
ahmet6118
Posts: 4
Joined: 16 Jun 2023, 08:17

18 Aug 2023, 15:39

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.
<h:outputText value="#{date}" style="display:block; text-align:center">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

18 Aug 2023, 16:16

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

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

ahmet6118
Posts: 4
Joined: 16 Jun 2023, 08:17

21 Aug 2023, 08:40

Melloware wrote:
18 Aug 2023, 16:16
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

Code: Select all

 excelOpt.setStronglyTypedCells(false);
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
Posts: 3717
Joined: 22 Apr 2013, 15:48

24 Aug 2023, 23:14

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

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests