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

Export To Excel - xlsx

29 Answers 501 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
Iron
Iron
Veteran
David asked on 12 Dec 2014, 06:46 PM
It seems there is demo that actually works : http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/exporting/excel-export/defaultcs.aspx
However, there is broken link to aspx.vb/aspx.cs files

Any suggestions?

29 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 17 Dec 2014, 10:30 AM
Hello David,

The demo you are referring to is working as expected on my end. Try to open in again and see how it works on your end.

Moreover, would you elaborate more on where are you seeing broken links? Are they in the linked demo or somewhere else? I would appreciate it if you could provide a screenshots or video that show the issue.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 17 Dec 2014, 10:35 AM
Yep, it works now. Thank you
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 17 Dec 2014, 11:03 AM
Hmm, when i tried to implement the solution for xlsx i received the following message:
"Could not load file or assembly
'Telerik.Windows.Documents.Spreadsheet, Version=2014.3.1024.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its
dependencies. The system cannot find the file specified."

It is a little strange, considering this is ASPX solution. Also, i don't have this dll.
Please advice where i can get it
0
Josh
Top achievements
Rank 1
answered on 18 Dec 2014, 02:29 PM
I've got the same issue as David.

"Could not load file or assembly
'Telerik.Windows.Documents.Spreadsheet, Version=2014.3.1024.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its
dependencies. The system cannot find the file specified."

Any suggestions?
0
Josh
Top achievements
Rank 1
answered on 18 Dec 2014, 02:31 PM
As a side note-this issue only appears when I include:

<ExportSettings>
     <Excel Format="Xlsx"></Excel>-
 </ExportSettings>
0
Viktor Tachev
Telerik team
answered on 19 Dec 2014, 01:08 PM
Hello Josh,

In order to prevent the error you should add the dll file to the bin folder of your application. The assembly is located in the ExternalLibraries folder in UI for ASP.NET archive. I would also recommend checking the following article that elaborates more on working with the Document Processing Library.


Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 19 Dec 2014, 02:32 PM
Viktor,

    After adding dlls i was able to export xlsx, however fields with with currency formatting export with "C" instead of "$".
    I am ok to loose "$" as xls does. What can be done?
0
Bill Wolff
Top achievements
Rank 1
answered on 22 Dec 2014, 06:39 PM
Note that this requires .NET 4.0 and above. I am doing work with SharePoint 2010 web parts which are stuck in the .NET 3.5 world so Xlsx is not a valid export type.
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 22 Dec 2014, 07:55 PM
We are 4.0
0
Kostadin
Telerik team
answered on 24 Dec 2014, 09:29 AM
Hi David,

Note that only the custom numeric format strings will work because in most scenarios they match the Microsoft Excel’s custom numeric format. The built-in .NET standard numeric format strings can still be used, but the output will not be as expected.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 24 Dec 2014, 02:57 PM
Hi Kostadin,

   So, how exactly i replace DataFormatString="{0:C2}" for example?

Thank you

David
0
Daniel
Telerik team
answered on 26 Dec 2014, 03:28 PM
Hello David,

Please try the following:
<ExportSettings SuppressColumnDataFormatStrings="true">

And add this code to the InfrastructureExporting event handler:
foreach (Row row in a.ExportStructure.Tables[0].Rows)
{
    row.Cells[1, row.Index].Format = "$#,##0.00";
}

Let me know whether this helps.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 26 Dec 2014, 03:58 PM
Hmm, I a little surprised that functionality as standard as this requires such a hack. I have like 50 grids to adapt using this approach.
Is there a simpler way to just eliminate $ formatting in xlsx (just export number)?
0
Daniel
Telerik team
answered on 26 Dec 2014, 04:50 PM
Hello David,

Indeed, it is possible to remove the ASP.NET format strings when exporting. You just need to set SuppressColumnDataFormatStrings="true" in ExportSettings.

I hope this helps.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 26 Dec 2014, 05:13 PM
Hi Daniel,

  Unfortunately SuppressColumnDataFormatStrings="true" didn't make any difference.
0
Daniel
Telerik team
answered on 29 Dec 2014, 09:15 AM
Hello David,

Could you please download the latest internal release and then try my suggestion again? There was a bug related to this functionality which should already be fixed in the internal release. If you have any troubles with this, please submit a ticket through the support system and add a reference to this forum post.
Please accept our apologies for any inconvenience caused.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Josh
Top achievements
Rank 1
answered on 05 Jan 2015, 04:18 PM
Viktor,

Thank you for the link. After adding the required dll's, things are working great.(Surprise, surprise)
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 05 Jan 2015, 04:20 PM
Hmm, not for me. Still exporting "C" instead of "$"
0
Daniel
Telerik team
answered on 08 Jan 2015, 03:37 PM
Hello David,

Can you please submit a support ticket with a link to this forum post so that I can send you a project with the latest internal build?

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 08 Jan 2015, 03:53 PM
Hi Daniel,

  Ticket submitted (ID is: 895009)

Thank you

David
0
Daniel
Telerik team
answered on 09 Jan 2015, 01:09 PM
I have sent the demo in the support ticket.

Thanks for your assistance.
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Magic
Top achievements
Rank 1
answered on 20 Jul 2015, 05:08 AM
Error Demo in ASP.NET MVC
0
Daniel
Telerik team
answered on 23 Jul 2015, 11:58 AM
Hello,

Did you change anything before running the demo? I ran that example locally but it worked out of the box.

Regards,
Daniel
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Magic
Top achievements
Rank 1
answered on 23 Jul 2015, 12:02 PM
I didn't change anything.  My UI for MVC might be old version. That's ok I will try to fix it.
0
MBEN
Top achievements
Rank 2
Veteran
answered on 08 Mar 2017, 08:23 PM

I use SuppressColumnDataFormatStrings="true" and it works fine for excel. However, I also have word and pdf exports and it changes the formatting for that as well.

is there an easier way than to manually change the formatting for ecery export type on every page that has exporting enabled in my application?

0
Marin Bratanov
Telerik team
answered on 13 Mar 2017, 11:33 AM

Hi,

The ItemCommand event will fire for each command so you can distinguish the different export types.

Then, you can try changing the property and format strings directly as per your needs. If this does not help, cancel the command (e.Canceled = true), modify the properties, and call the corresponding MasterTableViwe.ExportToXXXX() method (replace XXXX with the appropriate format, e.g., Pdf, Docx, as per the command name).

If you want this to propagate throughtout the application, you can use ASP_Themes. You can define the handler in a global class and apply the theme to all pages.

Regards,

Marin Bratanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
MBEN
Top achievements
Rank 2
Veteran
answered on 13 Mar 2017, 04:13 PM

I use themes in my application.

Could you provide an example of the global class handler to modify export properties?

0
Marin Bratanov
Telerik team
answered on 14 Mar 2017, 04:09 PM

Hi,

Code reusability is a matter that the application developer is better equipped to tackle than me. The concrete implementation will vary according to the application structure, requirements, limitations and the preferences of the developers. Also, there are many ways to do that. For example:

  • Encapsulate the grid in a user control that will have the data sources, handlers and properties ready. You can expose some configuration options via properties and then use that user control instead of the grid.
  • Inherit the grid in a custom class and add the needed handlers there.
  • Inherit the base Page class, add the necessary code there and set the handler name in the user control or inherited class. Actually, a Theme cannot set handlers, I had missed that in my previous answer.

Regards,

Marin Bratanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
MBEN
Top achievements
Rank 2
Veteran
answered on 16 Mar 2017, 04:53 PM

Thanks I got that. I got confused by the App_themes and I was wondering how o do that.

It works for me now.

Tags
Grid
Asked by
David
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Viktor Tachev
Telerik team
David
Top achievements
Rank 1
Iron
Iron
Veteran
Josh
Top achievements
Rank 1
Bill Wolff
Top achievements
Rank 1
Kostadin
Telerik team
Daniel
Telerik team
Magic
Top achievements
Rank 1
MBEN
Top achievements
Rank 2
Veteran
Marin Bratanov
Telerik team
Share this question
or