Formatted Printing of RadGridView

5 posts, 0 answers
  1. Alexander
    Alexander avatar
    78 posts
    Member since:
    Apr 2013

    Posted 24 Jun 2014 Link to this post

    Hello,
    I want to print/export the contents of a RadGridView. However, I want to retain the cell styles (or at least format it somewhat similar), especially for user-defined columns. For example, the number of decimal digits or the localized enum value should be retained.

    When I use the ElementExporting event and check for e.Element == ExportElement.Cell,
    the e.Context value points to the Column, not to the concrete cell. Is there any way to get the concrete GridViewCell? Or at least get the bound item?

    Alex

     
  2. Alexander
    Alexander avatar
    78 posts
    Member since:
    Apr 2013

    Posted 24 Jun 2014 in reply to Alexander Link to this post

    Okay - the reason is simply that for columns outside of the visible range, there simply dont exist any cells.
    So the e.Context would be Null in this case.

    As a workaround, I now determine the (formatted) cell content for myself from the column bindings.
  3. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Jun 2014 Link to this post

    Hello Alex,

    Indeed, this is correct. You can also refer to the Export FAQ article.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  4. Alexander
    Alexander avatar
    78 posts
    Member since:
    Apr 2013

    Posted 24 Jun 2014 in reply to Dimitrina Link to this post

    Thanks for the affirmation.
    Just another question: is there any way to control the layout of the columns?
    For example, reduce the page margin and increase the spacing between the individual columns.
    At the moment, the columns appear so squeezed...

    Alex
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Jun 2014 Link to this post

    Hello Alex,

    The columns appear as squeezed as they are still not realized and measured.
    One way would be to style the exported data setting the e.Styles dictionary with proper CSS values when the ElementExporting is raised for the RadGridView. You can refer to the "Exporting" demo for an example.

    As another approach you can check our new formatting options introduced together with Async Export. You can specifically check the article on ExportFormat.Html.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top