http://www.perlmonks.org?node_id=163509

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

Hi,

I have a simple two column spreadsheet.

Column A contains names, and B counts of the names.

How can I sprinkle column A's names along the X axis of my chart (instead of getting 1,2,3 etc)?

I've read all the documentation I can find on this but I'm stuck!

My efforts so far...

use Win32::OLE etc $axisrange="a1:a$i"; # names $range = "b1:b$i"; # counts of names print "range $range\n"; $Sheet->Range("$range")->Select; my $Chart = $Book->Charts->Add; $Chart->{ChartType} = -4100; $Chart = $Excel->ActiveChart; $SeriesCol = $Chart->SeriesCollection->Add; $SeriesCol->{XValues} = $Sheet->Range("$axisrange"); $Chart = $Excel->ActiveChart; etc
Can anyone offer a simple example or let me know what I'm doing wrong?

Thanks,

David

Replies are listed 'Best First'.
Re: Win32::OLE Excel and setting the X axis names
by Moonie (Friar) on May 02, 2002 at 15:03 UTC
Re: Win32::OLE Excel and setting the X axis names
by dws (Chancellor) on May 02, 2002 at 16:11 UTC
    Definitely read the article that moonie suggested.

    The way I approach problems like this when I have Excel on the box (which I don't right now -- sorry) is to record a Macro in Excel, then go through the steps to create and format the chart. The resulting Macro is in Visual Basic, but it's usually possible to reverse engineer it and convert it to Perl.