Hello,
I have been unable to find a demo/tutorial on how to export a WebChart to PDF or HTML format.
I noticed that ExportToPdf is not a member of the WebChartControl so this is not the way to go.
I would appreciate if you could provide me with some directions,
Thanks in advance,
Michel
We have closed this ticket because another page addresses its subject:
Web - Capability to print and export a WebChartControl on the client side
Hi,
Yes it's possible.
You should cast the WebChartControl to IChartContainer to accomplish it:
using (MemoryStream ms = new MemoryStream())
{
((IChartContainer)this.WebChartControl1 as IChartContainer).Chart.ExportToPDF(ms);
ms .Seek(0, System.IO.SeekOrigin.Begin);
//…
}
Please let us know whether this meets your needs.
Thanks,
Andrew
Thank you for showing me the direction to export a WebChart to PDF.
After conversion to VB , the code you suggested reads as follows:
Using ms As New MemoryStream()
TryCast(DirectCast(Chart_Main, IChartContainer), IChartContainer).Chart.ExportToPDF(ms)
'…
ms.Seek(0, System.IO.SeekOrigin.Begin)
End Using
I have a "The IChartContainer is not defined" message in my code.
I have the Imports DevExpress.XtraCharts. Do I need an extra DLL/imports statement to declare the IChartContainer object ?
Thank you,
Michel
Hi Michel,
I'm sorry, I've misinformed you in my previous reply. Unfortunately it's impossible to export a WebChartControl directly into the PDF.
I suggest that you create a new XtraReport document, and then utilize XRChart control abilities to display a chart similar to the one you've implemented via the WebChartControl. This way, you'll be able to display this newly created report via the ReportViewer on your web page, and then export its content to the PDF file.
Thanks,
Andrew
Hello Michel,
We've already answered a similar question, and I suggest that you refer to Export from WebChartControl.
Please review this issue, and let us know the results.
Best regards, Alan.
R&D, .NET Team.