Thanks a lot. The code really worked me. Am able to change the size of pie chart. But when i tried to use the same code for increasing size of a bar graph. I got some error
Below is the code i was trying to run for bar graphs
#use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $xl = Win32::OLE->new('Excel.Application'); $xl->{Visible} = 0; my $wb = $xl->Workbooks->Add; $bar_data = [ [ "Sam",22], [ "Tom",22], [ "Teddy",22], [ "Tommy",22], [ "Simon",22], ]; $sheet = $wb -> Worksheets(1); $sheet -> Activate; $range_of_data = $wb->ActiveSheet->Range("A1:B5"); $chart = $wb->Charts->Add; $chart->SetSourceData($range_of_data, 2); $chart->{ChartType} = 96; $chart->Location(2, "Sheet2"); $chart->{AutoScaling} = 0; $chart->SeriesCollection(1)->Points(1)->Interior->{Color} = 255; #vbRe +d $chart->SeriesCollection(1)->Points(2)->Interior->{Color} = 255; #vbRe +d $chart->PlotArea->{Width} = 1000; $chart->PlotArea->{Height} = 1000; $wb->SaveAs("D:\\Output.xlsx"); $xl-> {DisplayAlerts} = 0; $xl->Quit; $wb = 0; $xl = 0;
Below is the error am getting
Can't call method "Points" on an undefined value
Please help me to increase the size of the bar graph
In reply to Re^4: Prepare charts using Win32::ole
by soumyapanda
in thread Prepare charts using Win32::ole
by soumyapanda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |