Export To Excel - xlsx

30 posts, 0 answers
  1. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 12 Dec 2014 Link to this post

    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?
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1741 posts

    Posted 17 Dec 2014 Link to this post

    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.

     
  3. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 17 Dec 2014 in reply to Viktor Tachev Link to this post

    Yep, it works now. Thank you
  4. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 17 Dec 2014 in reply to David Link to this post

    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
  5. Josh
    Josh avatar
    16 posts
    Member since:
    Feb 2014

    Posted 18 Dec 2014 Link to this post

    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?
  6. Josh
    Josh avatar
    16 posts
    Member since:
    Feb 2014

    Posted 18 Dec 2014 in reply to Josh Link to this post

    As a side note-this issue only appears when I include:

    <ExportSettings>
         <Excel Format="Xlsx"></Excel>-
     </ExportSettings>
  7. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1741 posts

    Posted 19 Dec 2014 Link to this post

    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.

     
  8. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 19 Dec 2014 in reply to Viktor Tachev Link to this post

    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?
  9. Bill Wolff
    Bill Wolff avatar
    10 posts
    Member since:
    Jul 2006

    Posted 22 Dec 2014 in reply to Viktor Tachev Link to this post

    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.
  10. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 22 Dec 2014 Link to this post

    We are 4.0
  11. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 24 Dec 2014 Link to this post

    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.

     
  12. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 24 Dec 2014 in reply to Kostadin Link to this post

    Hi Kostadin,

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

    Thank you

    David
  13. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 26 Dec 2014 Link to this post

    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.

     
  14. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 26 Dec 2014 in reply to Daniel Link to this post

    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)?
  15. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 26 Dec 2014 Link to this post

    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.

     
  16. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 26 Dec 2014 in reply to Daniel Link to this post

    Hi Daniel,

      Unfortunately SuppressColumnDataFormatStrings="true" didn't make any difference.
  17. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 29 Dec 2014 Link to this post

    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.

     
  18. Josh
    Josh avatar
    16 posts
    Member since:
    Feb 2014

    Posted 05 Jan 2015 in reply to Viktor Tachev Link to this post

    Viktor,

    Thank you for the link. After adding the required dll's, things are working great.(Surprise, surprise)
  19. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 05 Jan 2015 in reply to Josh Link to this post

    Hmm, not for me. Still exporting "C" instead of "$"
  20. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 08 Jan 2015 Link to this post

    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.

     
  21. David
    David avatar
    197 posts
    Member since:
    Mar 2014

    Posted 08 Jan 2015 in reply to Daniel Link to this post

    Hi Daniel,

      Ticket submitted (ID is: 895009)

    Thank you

    David
  22. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 09 Jan 2015 Link to this post

    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.

     
  23. Magic
    Magic avatar
    2 posts
    Member since:
    Jul 2015

    Posted 20 Jul 2015 Link to this post

    Error Demo in ASP.NET MVC
  24. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 23 Jul 2015 Link to this post

    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
  25. Magic
    Magic avatar
    2 posts
    Member since:
    Jul 2015

    Posted 23 Jul 2015 in reply to Daniel Link to this post

    I didn't change anything.  My UI for MVC might be old version. That's ok I will try to fix it.
  26. MBEN
    MBEN avatar
    174 posts
    Member since:
    Nov 2011

    Posted 08 Mar Link to this post

    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?

  27. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3892 posts

    Posted 13 Mar Link to this post

    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.
  28. MBEN
    MBEN avatar
    174 posts
    Member since:
    Nov 2011

    Posted 13 Mar in reply to Marin Bratanov Link to this post

    I use themes in my application.

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

  29. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3892 posts

    Posted 14 Mar Link to this post

    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.
  30. MBEN
    MBEN avatar
    174 posts
    Member since:
    Nov 2011

    Posted 16 Mar in reply to Marin Bratanov Link to this post

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

    It works for me now.

Back to Top