Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Win32::OLE Excel problem

Reply
Thread Tools

Win32::OLE Excel problem

 
 
ancient
Guest
Posts: n/a
 
      11-19-2004
I am trying to create a Chart using win32::OLE and excel. I have
everything working except generating the background for the Chart.
The command I am using is --

$Excel->ActiveChart->ChartArea->Fill->{Visible} =1;
$Excel->ActiveChart->ChartArea->Fill->{ForeColor}->{SchemeColor} = 17;
$Excel->ActiveChart->ChartArea->Fill->{BackColor}->{SchemeColor} = 2;
$Excel->ActiveChart->ChartArea->Fill->TwoColorGradient({
Style => "msoGradientHorizontal",
Variant => 1 });

Everything seems to work until it hits TwoColorGradient. It finishes
executing, but does not set two colors for the gradient. It just
shows the ForeColor.

I would appreciate any help. I am soooo close!
 
Reply With Quote
 
 
 
 
Jay Tilton
Guest
Posts: n/a
 
      11-19-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (ancient) wrote:

: I am trying to create a Chart using win32::OLE and excel. I have
: everything working except generating the background for the Chart.
: The command I am using is --
:
: $Excel->ActiveChart->ChartArea->Fill->{Visible} =1;
: $Excel->ActiveChart->ChartArea->Fill->{ForeColor}->{SchemeColor} = 17;
: $Excel->ActiveChart->ChartArea->Fill->{BackColor}->{SchemeColor} = 2;
: $Excel->ActiveChart->ChartArea->Fill->TwoColorGradient({
: Style => "msoGradientHorizontal",
: Variant => 1 });
:
: Everything seems to work until it hits TwoColorGradient. It finishes
: executing, but does not set two colors for the gradient. It just
: shows the ForeColor.

msoGradientHorizontal is the name of a constant in MSOffice. You're
passing it to the method as a string. Not the same thing.

Import the Office constants into your program's namespace so you can use
the msoGradientHorizontal constant:

use Win32::OLE::Const 'Microsoft Office';

# stuff elided

$Excel->ActiveChart->ChartArea->Fill->TwoColorGradient({
Style => msoGradientHorizontal,
Variant => 1 });

You might also declutter things with a for() loop to alias a repeatedly
used object:

for( $Excel ->ActiveChart ->ChartArea ->Fill ) {
$_ ->{Visible} =1;
$_ ->{ForeColor} ->{SchemeColor} = 17;
$_ ->{BackColor} ->{SchemeColor} = 2;
$_ ->TwoColorGradient({
Style => msoGradientHorizontal,
Variant => 1
});

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with opening Excel after opening Excel inside Microsoft Internet Controls fniles ASP General 0 04-26-2009 09:39 PM
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
exporting an excel file from database; making changes to excel file and updating the database by importing it back Luis Esteban Valencia ASP .Net 1 01-12-2005 12:28 AM
Excel _WorkBook vs. Excel.Workbook =?Utf-8?B?SmltIEhlYXZleQ==?= ASP .Net 1 09-29-2004 03:48 PM
Win32::OLE Excel Chart SeriesCollection. Problem changing from Excel 2000 to 2002 moller@notvalid.se Perl Misc 1 07-05-2004 10:50 AM



Advertisments