Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Just wondering if it was possible to centre text and images on a worksheet. Not within a cell but within the contents of the page. Thanks guys
Digger

ps. Just another question while i'm posting. Can you create professional looking applications with perl using modules such as Tk. Is there any apps out there to look at. Once written can they be installed via an executable (without having to install the interpreter and required modules.

  • Comment on Excel vie OLE: Center text on the page?

Replies are listed 'Best First'.
Re: Win::OLE
by Grygonos (Chaplain) on Sep 24, 2004 at 12:49 UTC
    1. yes
    2. yes
    3. None I'm aware of.
    4. You would have to package the interpreter with your script. in other words.. perl will not defaulty compile to bytecode.
Re: Win::OLE
by Anonymous Monk on Sep 24, 2004 at 12:59 UTC
    I've looked all over the place for some sample code, but have had no luck.

      Take a look at the object browser in Excel. It contains full doc on every method you're trying to use via Win32::OLE Alt-F11 and then F2 while in Excel should bring up the object browser. Take a look around and get familiar with its object structure if you plan on doing any serious OLE programming at all. Sample code is nice and all, but copying and pasting someone else's code does not a learning experience make. However I would suggest looking at the Range object once you have Excel's object browser open. It should contain the tools you're searching for.

Re: Win::OLE
by elwarren (Priest) on Sep 24, 2004 at 15:57 UTC
    You can make good looking apps with Perl modules. Tk is a good start. Win32::GUI can make apps with real windows components (I never really liked the look of Tk, but Win32::GUI has a learning curve.) There aren't many good examples of Win32::GUI code though. I don't have access to any of mine on this machine, I may be able to post one later tonight.

    A good example of a deliverable compiled application made with perl and running on windows is the AmphetaDesk rss aggregator
      Thanks for the comments. In reply to the cut and paste comment, well, i have been coding in perl for a while now, also using Win::OLE for my excel generation for a few projects. Just havent' come across the code for centering the text like i initially explained. So I guess I was after some useful adivse. Thanks elwarren for the link to AmphetaDesk rss aggregator. Just what i wanted.

        I told you exactly where to find out how to center the text didn't I? Understanding it yourself is a great deal more rewarding than learning by wrote memorization. The only reason I made that comment is because you had not showed us what you tried. In the future, you'll find that posting what you have tried and showing your honest attempts will be very well received. Sorry if I was offputting, but I just wanted to make sure that someone was learning something..