Error with chartspace.exportpicture

A

Andrew Smith

I am trying to export a pivot chart to an image for inclusion in a
powerpoint report yet am having some issues. The code I am using is:

Sub ExportPivotChart()

Dim frm As form
Dim chartSpaceObj As OWC10.ChartSpace

For Each frm In Forms
If frm.Name Like "gra*" Then
Set chartSpaceObj = frm.ChartSpace
chartSpaceObj.ExportPicture "c:\test.gif", "gif", 1024,
1024
End If
Next frm

End Sub



if I use OWC10 then I get an RTE 430: Automation Error when it comes to the
export picture method. If I use OWC11 I get a RTE 13: Type Mismatch when
setting the chartspace object to the chartspace of my form. I would prefer
to use OWC10 as not all users have Office 03. Could anyone
suggest what I am doing wrong Please? This appears to do excatly whats
suggested in the MS help etc... and my head is about to explode!

Thanks

Andrew
 
A

Andrew Smith

I have fixed my issue with OWC10 by rolling back the dll from version
10.0.6765.0 to 10.0.6619.0. This appears to have sorted my issue - at last.

Is there a newer version of the component available with a fix to this bug?
 
A

Alvin Bruney - ASP.NET MVP

how about version 11? see if that fixes your problem.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
M

mlawry

I have done quite a lot of tests in relation to Microsoft Office Chart
10.0
and the ExportPicture method.

We use ExportPicture method through .NET 1.1 and AxOWC10.AxChartSpace
class (generated by AxImp tool), and we keep getting the following:

Exception type : System.Runtime.InteropServices.COMException
Exception Message : Unknown error

After a lot of effort I am able to consistent reproduce the error
on different computers. The setup required to reproduce this problem
is:

* Windows XP Service Pack 2
* Microsoft Office 2003 (incl Web Components)
* Install Office 2003 Service Pack 2 as the last thing.

OWC10.dll version for Office XP is 10.0.4109.0
OWC10.dll version for Office 2003 (no service pack) 10.0.6765.0
OWC10.dll version for Office 2003 SP2 is 10.0.6619.0

ExportPicture doesn't work after SP2 is installed, for other versions
it's fine. A simple way to see the error is to use the Visual
Studio .NET 2003 tool ActiveX Control Test Container.

1. Run the Test Container (the program is called tstcon32.exe);
2. Insert the Microsoft Office Chart 10.0 ActiveX control.
3. Fill in some data for the graph
4. Invoke it's ExportPicture method, you will get an exception.

Now I'm not too good with COM programming in C++, so I will
let the experts in Microsoft do the tests and find out why we get
an exception when invoking ExportPicture.

Please keep us updated.

Cheers,
Lawrence.
 
A

Alvin Bruney - ASP.NET MVP

why are you using axOWC*, that package is only for windows forms
applications. It isnt for web server code.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
L

Lawry

Well never mind about that AxOWC* stuff. If you really want
to know,is because we are using OWC from Windows Forms
Application, and that ExportPicture still doesn't work.

I'm pretty sure the problem (if Andrew Smith and I are in fact,
experiencing the same/related problem) is as Andrew's error message
suggests: an automation problem. And I believe I've "proved" it is
not a .NET nor ASP.NET specific problem by using the
ActiveX Control Test Container program.

Lawrence.
 
D

daarga

I had the same problem and I could solve with the "GetPicture()" Method.

If you want to save an image from a Chart object you can try this:

'Chart is a AxChartSpace of OWC11
Dim img() As Byte = Grafica.GetPicture("gif", 1280, 1024)
Dim MemImg As New System.IO.MemoryStream(img)
Dim imagen As Image = Image.FromStream(MemImg)
imagen.Save("C:\pruebafinal.gif")

This code is for a Windows Form but if you want to use in a WebForm you can
use

Response.BinaryWrite NewChart.GetPicture("gif", 1280, 1024)
 
L

Lawry

That's great!!! I will try out your code later this month, and will let
you know if it works.

Cheers,
Lawrence.
 
G

Gopal

I am getting the same error from the pivot table also. "Class does not
support automation or does not support expected interface". The MS site to
download the free version also is updated with this version.

Gopal
 

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