use strict; use Win32::OLE qw( in with ); use Win32::OLE::Variant; use Win32::OLE::Const 'Microsoft Excel'; use constant True=> 1; use constant False=> 0; my $Excel = Win32::OLE->new('Excel.Application', 'Quit') or die "$!"; $Excel->{'Visible'} = 1; my $Wkbook = $Excel->Workbooks->Add(); my $sheet1 = $Wkbook->Worksheets(1); #sample data $sheet1->Range("U10:W3")->{Value} = [[ 10, 20, 30 ], [ 5, 10, 20 ], [ 20, 7, 12 ], ]; my $range = $sheet1->Range( "U10:W3"); #add position, size chart1 my $chartObj = $sheet1->ChartObjects->Add( 2, 2, 600, 290 ); my $chart = $chartObj->Chart; $chart->{ChartType} = 96; $chart->SetSourceData($range); with($chart, HasLegend=> False , HasTitle=>True); $range = $sheet1->Range("U10:W63"); my $sc = $chart->SeriesCollection(1); my $ax = $chart->Axes; with($chart->PlotArea->Interior, ColorIndex=>-4142 ); with($chart, HasLegend=> False , HasTitle=> True ); with($chart->PlotArea->Border, Color=>0, LineStyle=> -4142, ColorIndex => -4142); with($chart->PlotArea->Interior, Color=> 16777215 ); with($chart->ChartArea->Font, Size=> 8 ); my $sc = $chart->SeriesCollection(1); my $pt = $sc->Points; with( $chart->ChartTitle, Text => 'JX'); with( $chart->ChartTitle->Font, Name=>'Arial', Size=>14, Bold=>True ); with( $ax->Item(xlValue), HasTitle => True); with( $ax->Item(xlValue)->AxisTitle, Text => "Frequency"); with( $ax->Item(xlCategory), HasTitle => True); with( $ax->Item(xlCategory)->AxisTitle, Text => "Age (Months)"); with( $sc->Interior, Color => 6697881 );