ChartSpace.ExportPicture() Method

A

A4e

hi

i am trying to use the ChartSpace.ExportPicture() method in a windoes forms
app but keep getting an error message 'System.InvalidCastException'...

can anyone advise please? the exact code i am using is below, all within a
button_click() event.... :

AxChartSpace1.ExportPicture("C:\mychart.gif", "gif", 280, 140)

many thanks in anticipation
 
J

jankrib

Your code worked for me, but I have heard about problems with the
ExportPicture before.

You can try to get the picture with the getPicture method like this:

Dim ChartImageArray() As Byte = CType(AxChartSpace1.GetPicture(),
Byte())
Dim ChartImageMemoryStream As New IO.MemoryStream(ChartImageArray)
Dim img As Image = Image.FromStream(ChartImageMemoryStream)

Then save the img to a file.
 
A

A4e

many thanks again!

this code worked... but is there an equivalent method for the PivotTable?

thanks
 
J

jankrib

many thanks again!

this code worked... but is there an equivalent method for the PivotTable?

thanks

Hmm.. For some reason the pivotTable object don't have the getPicture
function. I don't know why. I could need it myself., Why they have
the exportPicture sub, but not the getPicture function is a mystery to
me.

Regards,
Jan Kristian Bjerke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top