Re: Win32::OLE Excel Pie Chart

[email protected] (Ricardo Signes) Tue, 9 Oct 2012 11:24:24 -0400
Newsgroups perl.win32.vanilla
Message-ID <[email protected]>
* Rajesh Saha <[email protected]> [2012-10-09T09:32:26]
> my $Book = $Excel->Workbooks->Open( "$file") ;
> my $Sheet = $Book->Worksheets(1) ;
> my $chart = $Sheet->ChartObjects("Results");
> $chart->Activate() ;
> $chart->SeriesCollection(1)->Points(1)->Interior->{ColorIndex} = 4 ;
>  $chart->SeriesCollection(1)->Points(2)->Interior->{ColorIndex} = 3 ;
>  $chart->SeriesCollection(1)->Points(3)->Interior->{ColorIndex} = 6 ;
> $Book->Save ;
> $Book->Close ;

It's been a long time since I worked with Win32::OLE and Excel, but here's some
code I had:

  sub RGB { ($_[0] | ($_[1] << 8) | ($_[2] << 16)) }

  $chart->SeriesCollection('FailProduct')->Interior->{Color}
    = RGB(0xFF,0x00,0x00);

I'm not sure where the error you reported is coming from.  Figuring out which
of your specific lines is causing the problem might be a good start.  "Add more
print statements!"

-- 
rjbs
signature.asc (application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJQdEGoAAoJEOYby6cMccU5508H/j8ow3fJgMlmbdUFzgqhc9oO
/ESFtflXakRTWBRalTp/vnj2Lt3rVPKiaENuGPUdvL70sEl0PePLB1cdtMAQMf8E
d5KQ2Llog4/BazDiUzRYzSvNgzL27/cQlGSMd+z69MWSDB4cjp+vGuecXeZlcQ/c
u1lQJSZAgXEC01PcA92rRB5S1gMl7tihlcmLJKbEApl6a1bFiiokDvR7+cNYgKOS
CkqGGNA67hSjZJJD9RK4rDC/LzOESlDDIf8Cg8w1ECLlDZi9gJOdJdxCLbU4JwxW
YNDck0XLpm0L1DHLAwEnRjOG2/hm5WwhU0bF6EuPFK+MRgReU0QC9543g0ALC+o=
=/s1b
-----END PGP SIGNATURE-----