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

Export RadChartElement from RadGridView

5 Answers 81 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 17 Aug 2016, 12:22 PM

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

5 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 19 Aug 2016, 01:36 PM
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.
0
Christian
Top achievements
Rank 1
answered on 23 Aug 2016, 11:19 AM

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.

0
Hristo
Telerik team
answered on 24 Aug 2016, 08:39 AM
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.
0
Christian
Top achievements
Rank 1
answered on 24 Aug 2016, 11:47 AM

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.

0
Hristo
Telerik team
answered on 25 Aug 2016, 10:17 AM
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.
Tags
ChartView
Asked by
Christian
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Christian
Top achievements
Rank 1
Share this question
or