Hi Perl Monks,

I am new to perl and I am trying use perl to automate the process of executing a program, process the the result and present the data in Excel. I ve followed the samples in your site and some other resources, but the win32::ole function didnt work very well with excel in my case:

I can create a workbook, insert data and create a new chart with perl in excel, however, I cannot change the chart type, set the tile, axis title or run a macro.

I use the following code to

#create chart and title: my $Chart = $ex->Charts->Add; $Chart->{HasTitle} = 1; my($title)="Analysis Result ".$fileIndex; $Chart->ChartTitle->{Text} = $title; #define cahrt type: $Chart->{ChartType} = "xlLineMarkers"; $Chart->Location({Where => "xlLocationAsNewSheet"}); #set axis title: my $Xaxes = $Chart->Axes("xlCategory", "xlPrimary"); $Xaxes->{HasTitle} = 1; $Xaxes->{AxisTitle}->{Characters}->{Text} = "X Title"; my $Yaxes = $Chart->Axes("xlValue", "xlPrimary"); $Yaxes->{HasTitle} = 1; $Yaxes->{AxisTitle}->{Characters}->{Text} = "Y Title";

I ve put all this in the perl program but it has no effect, the chart always diplay as bar charts, and I can use perl to delete and data set in it.

Also If I insert the data first and create chart, as I can remove the data set, it alwasy give me the wrong data set in chart.

what's wrong with the code, I really dont know, are there any setting that I need to set on excel to use this function?

It is a kinda urgent one :(, I would appriciate if anyone could give me some advice.

thanks!


In reply to Using win32::ole on Excel by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.