Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
We don't bite newbies here... much
 
PerlMonks  

Re: How do I print the page header/footer from an excel spreadsheet

by Albannach (Monsignor)
on Nov 08, 2006 at 13:01 UTC ( [id://582941]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How di I print the page header/footer from an excel spreadsheet

my $Book = $Excel->Workbooks->Open('test.xls'); my $Sheet = $Book->Worksheets("Sheet1"); $Sheet->Activate(); for my $position ( qw( Header Footer ) ) { for my $element ( qw( Left Center Right ) ) { my $item = $element . $position; print "$element$position: ", $Sheet->PageSetup->$item, "\n"; } }
++ to the first person to show me how to eliminate $item - I feel like it is unnecessary.

--
I'd like to be able to assign to an luser

Replies are listed 'Best First'.
Re^2: How do I print the page header/footer from an excel spreadsheet
by boat73 (Scribe) on Nov 08, 2006 at 13:32 UTC
    Perfect, thanks much
Re^2: How do I print the page header/footer from an excel spreadsheet
by friedo (Prior) on Nov 08, 2006 at 13:50 UTC
    ++ to the first person to show me how to eliminate $item - I feel like it is unnecessary.
    $Sheet->PageSetup->${ \"$element$position" };
      You can use the "hash syntax" to access object properties (see Win32::OLE documentation)Properties of an object are implemented as a hashref, so more simply:

      $Sheet->PageSetup->{"$element$position"} # or $Sheet->PageSetup->{$element . $position}
      Update: pr
        Not all objects work that way under the hood, though. It's bad practice to access the hash data directly. (Though it's probably not very good practice to use arcane syntax for dynamic method names either!)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582941]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.