I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-07-19 08:43:27-07 by shamus
XL CHARTS
Hi This is a bit long-winded, but anyway ...... This VB code works on Excel 2000:
Set xlmap = shellXL.Charts.Add With xlmap .ApplyCustomType 22,"MyMap" .ApplyDataLabels -4142, False .ChartTitle.Text = xtitle .Axes(1).TickLabels.Font.Size = 8 .Legend.Left = 77 .Legend.Top = 25 .Legend.Interior.ColorIndex = 15 .Legend.Interior.Pattern = 1 End With
My translation to Win32::OLE code doesn't work:
$xlmap = $shellXL->Charts->Add; # seems ok ... $xlmap->ApplyCustomType(22,"MyMap"); # seems ok $xlmap->ApplyDataLabels(-4142, 0); #FAILS = ".. propertyGET..." $xlmap->ChartTitle->{Text} = $xtitle; #FAILS = "Exception occurred in propertyPUT..." $xlmap->Ax +es(1)->TickLabels->Font->{Size} = 8; #FAILS " TickLabels... propertyGET ..." with ($xlmap->Legend, Left => 77, Top => 25); #FAILS " Left @ Win32-OLE-Lite line-201" with ($xlm +ap->Legend->Interior, ColorIndex => 15, Pattern => 1); #FAILS" Interior @ Win32-OLE-Lite line-201" #FAILS " Interior ... propertyGET ..."
In most cases the complaint is: ".. unable to get/set property ..." ok that was mostly guessing about the perl distinction between "members" as to whether they are methods or properties, using the rule-of-thumb: make the last member a curly-braced property but otherwise assume a method. With VB syntax that distinction is often not essential to explicate. And, as we may know, VB inter-replicates and mixes them up a bit just so they can often be used interchangeably. Looks like the problem may be when some SAMENAMED THINGY is only alterable as the attribute of a sub-object returned from the READ-ONLY attribute of another object when accessed, VB somehow able to transparantly transpose the action perhaps, but not Win32::OLE ? So a few adjustments produced a minor advance, but hardly success?:
$xlmap = $shellXL->Charts->Add; # seems ok still $xlmap->ApplyCustomType(22,"MyMap"); # seems ok still $xlmap->ApplyDataLabels(-4142, 0); #FAILS = ".. propertyGET..." $chart_title = $xlmap->{ChartTitle}; # seems ok .... returns a HASH object $chart_title->{Text} = $xtitle; #FAILS = "Exception occurred in propertyPUT..." $axis_label = $xlmap->Axes(1)->{TickLabels}; # FAILS returns "" " ... propertyGET ..." $label_font = $axis_label->{Font}; # FAILS ... returns "" $label_font->{Size} = 8; # $legend = $xlmap->{Legend}; # seems ok ... returns a HASH object with ($legend, Left => 77, Top => 25); #FAILS " Left @ Win32-OLE-Lite line-201" $insides = $Legend->{Interior}; #FAILS ... returns "" ...propertyGET ..." with ($insides, Color +Index => 15, Pattern => 1); #
At this stage I've run dry on inspiration, so if anyone can see one or more specific error(s) in the perl code above, I would be grateful to hear... (sorry if the perl code looks wonky in display -- dunno why that is?) cheers shamus
Direct Responses: Write a response