Export RadChartElement from RadGridView

6 posts, 0 answers
  1. Christian
    Christian avatar
    17 posts
    Member since:
    May 2016

    Posted 17 Aug Link to this post

    Hi,

    I'd like to export radchartelements listed in a radgridview as pdf or printable page. It works half way because Telerik exports in both cases (pdf or print) a table with rows containing the type which is passed as datasource onto the gridview. Taking a picture with .PrintPreview(Me.RadPrintDocument1) returns a blank page, so this is not helping either. What am I missing here?

    BR

  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 19 Aug Link to this post

    Hi Christian,

    Thank you for writing.

    The engine responsible for printing the grid extracts the value of its cells. In the case of a custom cell with an added chart element, it will return the value of this cell which is the data bound object.

    You can achieve the desired result by creating an image out of the cells and store it in the Tag property of the GridViewCellInfo objects. Then you would need to create a special print renderer responsible for assigning the image stored in the Tag property to the print cell.

    Please note that this functionality is not supported out of the box and the present solution might not cover all possible cases.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Christian
    Christian avatar
    17 posts
    Member since:
    May 2016

    Posted 23 Aug Link to this post

    Hello Hristo,

    thank you very much for the elaborate answer and the provided solution. It works on my end so this is a big step forward. Now I am adapting the code to my case, which almost works out of the box.

    You helped me a great deal, big thanks to you.

  5. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 24 Aug Link to this post

    Hi Christian,

    Thank you for writing back.

    I am glad that the suggested solution fits well your local setup. I have slightly modified the project to include an easier solution without actually having to create a custom renderer.

    The new approach actually follows the previously suggested one with the difference that the image we create is set in the handler of the PrintCellFormatting event. This way the heavy operation of creating the image itself will be executed only if you need to print the grid along with the chart elements. Feel free to choose whatever solution fits better your scenario.

    I hope this information was useful. Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
  6. Christian
    Christian avatar
    17 posts
    Member since:
    May 2016

    Posted 24 Aug Link to this post

    Hello Hristo,

    thank you for the new code. I've implemented a similar solution which is more suited to my case, but I'll keep the provided solution for reference.

    Thank you.

  7. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 25 Aug Link to this post

    Hello Christian,

    I am glad I was able to help. 

    Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready