rbid has asked for the wisdom of the Perl Monks concerning the following question:

Hello

Does someone have an example of generating a "Surface" (xlSurface) chart in Excel using perl.

All the examples talk about simple charts but not about Surface charts which are 3D charts..

... my $Range = $Sheet->Range('a1:d5'); my $Chart = $Excel->Charts->Add; $Chart->{ChartType} = xlSurface; # <<<<<<==== I get an exception here $Chart->SetSourceData({Source => $Range, PlotBy => xlColumns}); $Chart->{HasTitle} = 1; $Chart->ChartTitle->{Text} = "Some Title"; ...

The exception I get when running the script is:

Win32::OLE(0.1709) error 0x80020009: "Exception occurred" in PROPERTYPUT "ChartType" at sd_reporter.pl line 224

Any Hint?

Thanks in advance.

--- Ricky Marek.

Replies are listed 'Best First'.
Re: Win::OLE Surface Chart...
by davies (Monsignor) on Aug 17, 2011 at 09:47 UTC

    Do you start with the following?

    use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel';

    If you don't have that fourth line, you can't use xlSurface. Or you could try putting in 83, but if so, I advise commenting it to make it clear that it's supposed to be xlSurface. But it's easier to give you an accurate answer if you show minimal working code that replicates the problem.

    Regards,

    John Davies