Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: OLE::WIN32 Excel Range Selection

by bassplayer (Monsignor)
on Dec 31, 2003 at 16:56 UTC ( #317932=note: print w/ replies, xml ) Need Help??


in reply to OLE::WIN32 Excel Range Selection

Are you using SpreadSheet::WriteExcel by jmcnamara? This is just a guess from glancing at the docs, but perhaps merge_range() is what you are looking for?

bassplayer


Comment on Re: OLE::WIN32 Excel Range Selection
Re: Re: OLE::WIN32 Excel Range Selection
by mitchems (Initiate) on Dec 31, 2003 at 17:17 UTC
    No, I'm using Win32::OLE because I have to create graphs in excel and move them to powerpoint (apparently powerpoint is the only language my boss understands).

    What I am doing is creating a graph. The entire code is:

    $data[0]='162|There is a Project Management office in place that monit +ors, participates and reports on projects|7|0'; $data[1]='163|There is a PMO that provides policies/procedures/tools f +or project planning/tracking, which are used regularly|0|0'; $data[2]='164|There is no PMO, however, formal policies/procedures/too +ls exist are used regularly|46|0'; $data[3]='165|Formal policies/procedures/tools exist but are not used| +0|0'; $data[4]='166|Ad hoc, no formal policies/procedures|46|1'; $qid=65; $binst=10; $cname='Client Name'; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; $Win32::OLE::Warn = 3; $Excel = Win32::OLE->new('Excel.Application') or die "oops\n"; my $Book = $Excel->Workbooks->Open("c:\\stage\\scratch.xls"); my $Sheet = $Book->Worksheets("data"); # skip empty cells $row=1; $col=1; $x=0; $y=1; for (@data){ $x++; ($id,$label,$value,$checked)=split(/\|/); $Sheet->Cells($row,$col)->{'Value'}=$label; $Sheet->Cells($row,$col+1)->{'Value'}=$value; $Sheet->Cells($row,$col+2)->{'Value'}=$checked; if($checked==1){ $y=$x; } $row++; } my $Range = $Sheet->Range("A1:B5"); my $Chart = $Book->Charts->Add; $Chart->ChartWizard($Range,xlPie,6,xlColumns,1,0,1,"Approach to Projec +t Management"); $text=$Chart->SeriesCollection(1)->Points(1)->DataLabel->{Text}; $Chart->SeriesCollection(1)->Points($y)->DataLabel->{Text} = "$cname\n +$text"; $Chart->Legend->{Position} = xlLegendPositionBottom; $Book->Close;

    It is a test for creating multiple graphs in Excel.

    Any ideas on the syntax?

      Oh, and scratch.xls is just an empty spreadsheet with on sheet called "data" - it doesn't have any other sheets or graphs on it when it starts. M.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://317932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-07-24 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls