CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Win32::OLE ms word read write object table properties


New User

Jan 21, 2011, 7:26 AM

Post #1 of 1 (1639 views)
Win32::OLE ms word read write object table properties Can't Post

I like to make this thread the ultimate win32::OLE thread....
to ask questions about reading/writing about ms word and excel and other OLE objects in Perl. These objects could be table, paragraph, diagram, etc. and you want to be able to read, write, read the paragraph or line above, below, select a particular text, copy, paste, etc.

My question:

Which libraries to use?

well, for my first task I wanted to be able to open word documents in a folder and read one table by row and column.

Now , after searching through the net I found bunch of libraries people include, a couple of them appears all the time but some of them vary depending on the program people use:

# we are going be working with MS Word Objects
use Win32::OLE qw(in with); # used a lot

# sometimes uses
use Win32::OLE::Const 'Microsoft Word';
use Win32::OLE::Enum;

Not sure exactly what the last two libraries do? can someone show me step by step by step how do I look it up in CPAN?

Finally, the part I am really stuck in my program is however, being able to see all the methods and properties of an object which I get hold off:

e.g. # get the first table
my $table = $word->ActiveDocument->Tables(1);

How do I now list this table's methods and would I know what they are? Where are these documented? Win32::OLE is a bit dry and very example-free.

Another side question: when I open documents, can I supply relative path? I can only open now using absolute path:

e.g. $Word->Documents->Open("$doc") || die("Unable to open $doc ", Win32::OLE->LastError());

$doc cannot be "..\\FOLDER\\FOLDER\\DOC.DOC

it has to be "C:\\FOLDER\\FOLDER\\FOLDER\\DOC.DOC"

can I make it relative?
Please help.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives