Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Can I use Win32::OLE to insert a TIFF in a Word document?

by bloodelf2 (Initiate)
on May 26, 2001 at 02:47 UTC ( #83446=perlquestion: print w/ replies, xml ) Need Help??
bloodelf2 has asked for the wisdom of the Perl Monks concerning the following question:

I need to use perl to open an ms-word document, insert a .tif and then save the file in .rtf Can this possibly be done with WIN32::OLE??? I have searched high and low for a suitable tutorial on this module, but could not find one (all I need is an explanation of the module's commands.) can anyone help!!

2006-03-15 Retitled by g0n, as per Monastery guidelines
Original title: 'WIN32::OLE'

Comment on Can I use Win32::OLE to insert a TIFF in a Word document?
Re: Can I use Win32::OLE to insert a TIFF in a Word document?
by myocom (Deacon) on May 26, 2001 at 02:58 UTC

    Yes, you can drive MSWord with Win32::Ole. The module's commands can be found by reading its POD ('perldoc Win32::Ole' from a command prompt, or CPAN's HTML copy).

Re: Can I use Win32::OLE to insert a TIFF in a Word document?
by rchiav (Deacon) on May 26, 2001 at 04:12 UTC
    You can use use Win32::OLE to do this.. but it's not Win32::OLE that actually does what you're looking for. It will give you access to the COM objects that are available within Word, but you have to know how to use those COM objects. Take a look at this for a the Word object model refrence.

    Hope this helps..
    Rich

      That link to MSDN now seems to be defunct, but as of today (2003-02-24) good info can be found using this page as a starting point.

      jdporter
      The 6th Rule of Perl Club is -- There is no Rule #6.

Re: Can I use Win32::OLE to insert a TIFF in a Word document?
by mpolo (Chaplain) on May 26, 2001 at 21:03 UTC
    Basically, (as mentioned in another response) the docs that will get you anywhere are found on the Microsoft Developer Network. These are all geared toward Visual Basic, but you just need to translate them into perl (arrows instead of dots, for instance).

    One gotcha occurs when you want to assign a value to a property. To get a proper lvalue for assignment, you need to enclose the property name in braces:

    $sheet->Cells(3,3)->Font->{Bold}=1
    would be an example in Excel.

      I've found MSDN to be useful for the latest version of M$ products, but not for older ones. At this point, Office 98, which I use, is "really old" :-)

      If you have Visual Basic installed, you can use its Object Browser to help ferret out the details. Create a new project, use Project/References to add the approprate library (Microsoft Word 8, or whatever). Then use the object browser.

      The descriptions are not as good as the MSDN docs, when available, and there is no "usage" information, but it will certainly point you in the right direction, and helps immensely when dealing with M$ "upgrades".

        I found some excel examples that helped me understand how to convert some of the code. With MSWord open, I recorded a macro to do the task I was interested in, then I edit the code. I also searched for other examples and got lucky with one hit on the Microsoft Knowledge Base. I'm new on this site so I don't know yet where to post a large file with lots of samples in it. Email me at KTOMIAK@ATTGLOBAL.NET

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://83446]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-09-22 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls