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

Format type for exported Excel in telerik reporting is not proper for Date and Number fields

10 Answers 860 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vikram
Top achievements
Rank 1
Veteran
Vikram asked on 07 Oct 2020, 06:42 AM

Hi All, 

Format type in excel for the date and number fields is showing as 'General' and 'Custom'.

How to convert the excel format to 'Short Date' and 'Number' format type from report side.

Please find the attached files.

Thanks

Vikram

10 Answers, 1 is accepted

Sort by
0
Vikram
Top achievements
Rank 1
Veteran
answered on 09 Oct 2020, 11:22 AM

HI All,

Please provide an a update on this issue. 

Thank

Vikram Mahendra

0
Todor
Telerik team
answered on 12 Oct 2020, 07:47 AM

Hello Vikram,

To preserve the result from previewing the rendered document, formats are saved as custom formatting strings in the Excel file. This behavior can be modified by setting UseExtendedFormatting = False in the Excel device information settings. See Excel Formatting Strings for more details.

This way, a Numeric field that is formatted with the Format property of the TextBox will be exported as a Number in Excel.

The DateTime fields are exported as Date when the Format property of the TextBox is {0:d}. In the other cases, it gets exported in Custom or General format. This behavior doesn't seem correct to me and we will research it further.

If you format the field inline, for example, with the text function Format, it will be converted to a String and exported as Custom. That is the reason you don't get the desired type in Excel.

Regards,
Todor
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Vikram
Top achievements
Rank 1
Veteran
answered on 12 Oct 2020, 09:33 AM

Hi Todor,

Thanks for your reply. 

Can you please help us with an example on how to set (UseExtendedFormatting = False), As we are not able to find Excel device information settings.

Waiting for your reply. 

Thanks 

Vikram

0
Todor
Telerik team
answered on 15 Oct 2020, 06:53 AM

Hello Vikram,

You may provide the setting in the configuration file of the application that hosts the Reporting engine. See extensions Element article for details and an example. Here is how the section should look like:

<?xml version ="1.0"?>
<configuration>
	<configSections>
		<section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting" allowLocation="true" allowDefinition="Everywhere"/>
		...   
	</configSections>
	...
	<Telerik.Reporting>
		<extensions>
		  <render>
			<extension name="XLSX" description="Excel Description">
			  <parameters>
				<parameter name="UseExtendedFormatting" value="False"/>
			  </parameters>
			</extension>
		  </render>
		</extensions>
	</Telerik.Reporting>
	...
</configuration>

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Vikram
Top achievements
Rank 1
Veteran
answered on 15 Oct 2020, 10:59 AM

Hi Todor,

Thanks for reply. 

I added the above configuration code in Web.Config file. 

But still Number fields are in Custom format in Excel.

I am using Angular UI and Restful services.

Kindly let me know any solution for this issue. 

Thank, 

Vikram

 

0
Todor
Telerik team
answered on 20 Oct 2020, 09:21 AM

Hello Vikram,

Please, check this silent video that demonstrates the outcome when exporting in Excel with different values for UseExtendedFormatting in the Standalone Report Designer. Note that with False, the numbers got exported as Excel Number format.

Just to clarify that the Reporting engine that runs in the designer and in the Telerik Reporting REST Service for .NET Framework is the same.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Vikram
Top achievements
Rank 1
Veteran
answered on 29 Oct 2020, 09:29 AM

Hi Todor, 

The above solution is working fine for Excel Description (.xlsx) format. 

Not working for Excel 97-2003 (.xls) format.

Is there any work solution or workaround for reports exported in .xls format.

Thanks 

Vikram 

0
Todor
Telerik team
answered on 03 Nov 2020, 07:21 AM

Hello Vikram,

For XLS rendering extension you need to specify another extension element in the configuration file - see Excel 2003 Device Information Settings:

<extension name="XLS" description="Old Excel Description">
  <parameters>
    <parameter name="UseExtendedFormatting" value="False"/>
  </parameters>
</extension>

My local tests confirmed that the approach works also for XLS.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Vikram
Top achievements
Rank 1
Veteran
answered on 03 Nov 2020, 02:39 PM

Hi Todor, 

The solution given is working fine when we export to excel from standalone report designer as show in attachment, 

But when we try to export through the application it shows custom for both number and date fields. 

We tried adding your recent "XLS" extension solution in .exe file, but still now working. 

Please let us know what else we need to do. 

Thank you

Vikram 

 

0
Todor
Telerik team
answered on 06 Nov 2020, 09:33 AM

Hello Vikram,

You must use the same configuration in the config file of your application. This would be the web.config file of the REST Service, or the app.config if you embed the reporting engine in a desktop application.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Vikram
Top achievements
Rank 1
Veteran
Answers by
Vikram
Top achievements
Rank 1
Veteran
Todor
Telerik team
Share this question
or