I am using VB Net and telerik controls to build a web application. I have a screen with a few ColumnChart RadHtmlCharts on, and I need to get them into a PowerPoint Presentation in the Code Behind file.
My current approach is taking an existing .PPTX file and stepping through it, replacing text where required and so on. Now I just need to get the charts into the presentation.
Here is the loop that I am making through the slides.
' generate
For Each slide As SlidePart In pCopy.PresentationPart.SlideParts
' THIS IS WHERE THE CHARTS NEED TO BE ADDED TO THE SLIDE
Next
Note: I have written a function that returns the chart, all I am missing now is the steps required to get it into the presentation.
Here are the 'Imports' I have included...
Imports Telerik.Web.UI
Imports System.Data
Imports System.IO
Imports System.Data.SqlClient
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.PowerPoint
Imports DocumentFormat.OpenXml
Imports DocumentFormat.OpenXml.Packaging
Imports DocumentFormat.OpenXml.Presentation
Any help will be greatly appreciated
Assuming you know how to put images in the pptx file (I, myself, don't), you "only" need to get the images from the HtmlChart. There several approaches:
start from the following code library on exporting the control: http://www.telerik.com/support/code-library/exporting-radhtmlchart-to-png-and-pdf Using the ClientExportManager control is quite straightforward.
this should provide you with an image of the chart on your server that you can use in your existing code
Other ideas you can consider:
you can use a service to get many images on your server first if you want to embed multiple charts: http://docs.telerik.com/devtools/aspnet-ajax/controls/clientexportmanager/how-to/save-exported-files
tools like PhantomJS can let you run the browser on the server so it can generate the charts, that you can export and embed. Otherwise you will need end user action to load the page with the charts