Invalid date format after export report to xlsx (excel)

1 Answer 232 Views
.NET 5 .NET Core Report Designer - Web Report Viewer - HTML5
LLCD
Top achievements
Rank 1
Iron
LLCD asked on 05 Aug 2023, 11:09 AM | edited on 09 Aug 2023, 08:10 AM

Hello.

Currently I am designing a report on which I have date and datetime data types.

I have prepared the data-base table with data that goes into the report (attachment data-model.png)

I prepared report template in telerik web report designer (attachment report_template.png)
I set format according to Standard DateTime Format Strings
Field with date data has format {0:d}

On preview (at Web Report Designer) the date seems to be ok (attachment preview.png)

Unfortunately, after exporting the report to excel (xlsx), the date type is not a date in excel (attachment invalid_format.png)

My appsetting.json file contains

"telerikReporting": {
  "extensions": [
    {
      "name": "XLSX",
      "parameters": [
        {
          "name": "UseExtendedFormatting",
          "value": "False"
        }
      ]
    }
  ]
}

 

What should I have to set/do in order to have date format in excel for cells that contain date and date-time data?
I would like to achieve result like below: for cell that contain date data in report I need date format in excel

I would like to emphasize that Standard Numeric Format Strings work:

  • C or c (Currency) works fine
  • N or n (Number) works fine
  • G or g (General) works fine
  • P or p (Percent) works fine

Environment:

  • Visual Studio 2022
  • .NET 6
  • Web report designer written in Razor pages
  • Packages (I know it's not the latest version, but it works the same badly on the latest version)
    • Telerik.Reporting v. 16.2.22.1109 (v2022.3.1109)
    • Telerik.Reporting.OpenXmlRendering v. 16.2.22.1109 (v2022.3.1109)
    • Telerik.WebReportDesigner.Services v. 16.2.22.1109 (v2022.3.1109)
  • jQuery v. 3.6.0
  • Windows culture pl-PL
  • I run my project on IIS
    • IIS version 10
    • culture pl-PL
  • project culture pl-PL
  • I set kendo.culture("pl-PL");
    • culture file https://kendo.cdn.telerik.com/2022.3.1109/js/cultures/kendo.culture.pl-PL.min.js

regards

1 Answer, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 09 Aug 2023, 05:08 PM

Hello Bartłomiej,

Thank you for providing such a detailed description of the issue.

I tested the behavior locally and can confirm that the Standard DateTime Format Strings are hard coded as custom formats with their corresponding format strings in the current regional settings of the machine rendering the reports.

Thus, I have logged a bug item in our Public Feedback Portal and added a vote to it on your behalf. This increases the priority of the item and subscribes you to receive notifications about future status changes. I am also updating your account's Telerik Points as a token of gratitude for pointing this out.

That said, I was unable to come up with a usable workaround. Changing the culture of the thread changes the format of the date string accordingly. Also, if you need to provide reports for clients from different cultures, perhaps the approach suggested in the following article will work for you.

Pass Culture from the Report Viewer to the REST Service - Telerik Reporting

I hope this helps.

Best Regards,
Momchil
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
.NET 5 .NET Core Report Designer - Web Report Viewer - HTML5
Asked by
LLCD
Top achievements
Rank 1
Iron
Answers by
Momchil
Telerik team
Share this question
or