This is a migrated thread and some comments may be shown as answers.

DateTime format lost after exporting to Excel

4 Answers 231 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
taras
Top achievements
Rank 1
taras asked on 28 Jan 2011, 05:08 AM
Hi,

While report viewer correctly identifies any DateTime field data type and applies proper formatting. The ExportToExcell operation yield the the same field as double (or float).

The work around is to force Telerik.Reporting.TextBox.Format to "{0:G}".

I have published the test project here: http://dl.dropbox.com/u/2192462/Telerick.Reporting.Bug/WpfApplication1.7z

Cheers,


4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 28 Jan 2011, 06:39 PM
Hello taras,

The described behavior is by design. As noted in the Design Considerations for Excel Rendering help article, if a valid format string is detected by the rendering extension, the raw value will be stored in the cell as a Number and an Excel Number Format will be applied. Otherwise the value will just be stored in the cell, again as a Number, but without formatting. Even unformatted, it would be possible to use the resulting cell in Excel functions.

Best wishes,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
taras
Top achievements
Rank 1
answered on 29 Jan 2011, 01:47 AM
Thank you Peter,

I thought it might be the case. Thus it is not a bug but a design flaw. Minor, but a flaw. I think you may consider changing it in the future releases.

The fundamental concept of all (except Excel) exporting algorithms is "what you see in the report is what you get in the exported output". The ExportToExcel routine clearly does not implement this concept while other exports do.

At the same time the paradigm you described (no formatting info -> render raw value) is not followed by the ReportViewer control. This control is smart enough to understand that the default formatting for DateTime type is "{0:G}". So why ExportToExcel cannot do the same.

I see the actual problem not in the decision to handle or not to handle default formatting by one or another routine but in the inconsistency in making such decisions across all data rendering/transformation routines.

I am not picky I just want to improve the product, which I in fact found to be very solid and mature.

All the best,
Taras
0
Peter
Telerik team
answered on 01 Feb 2011, 05:06 PM
Hello Taras,

We have discussed the current reporting behavior regarding the DateTime format in the Excel Rendering Extension and concluded that your suggestion makes sense. Thus we will add a default format for the DateTime types for example {0:G}. Still this is a low priority task so I can't engage with a time frame when the suggested improvement will be available.

Your Telerik points have been updated for bringing this to our attention.

Kind regards,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
taras
Top achievements
Rank 1
answered on 01 Feb 2011, 11:44 PM
Thank you Peter for being constructive.

And I think "low priority" is quite appropriate in this case. Particularly because the adequate work around is available.

Best regards,
Taras
Tags
General Discussions
Asked by
taras
Top achievements
Rank 1
Answers by
Peter
Telerik team
taras
Top achievements
Rank 1
Share this question
or