Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Insert an image into a Word document

by dbpack (Initiate)
on Apr 12, 2009 at 09:17 UTC ( [id://757085]=perlquestion: print w/replies, xml ) Need Help??

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

I'm working on a perl script to automate the creation of a daily report. Some of the data is scraped from our website using WWW::Mechanize, but there are some images of graphs generated from this data using GD::Graph that need to go into the word document. Any idea how to do this? It looks like Win32::Word::Writer doesn't handle inserting images... Thanks in advance.

Replies are listed 'Best First'.
Re: Insert an image into a Word document
by CountZero (Bishop) on Apr 12, 2009 at 09:30 UTC
    If it is your web-site, why would you need to scrape its contents? Don't you have direct access to the data?

    If Win32::Word::Writer doesn't have a handy function to include images, the you must use Win32::OLE.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Insert an image into a Word document
by jplindstrom (Monsignor) on Apr 14, 2009 at 14:46 UTC
    Win32::Word::Writer is essentially a convenience wrapper around Win32::OLE. The Writer docs contains some advice on how to figure out how to automate Word in general.

    I don't think it will be difficult. It would mostly be about translating VBA scripts into Perl, and the Win32::Word::Writer source has plenty of examples on how to do that. The OLE Word and Document objects are both available to call methods on.

    If you do implement it as part of Win32::Word::Writer, I'd be happy to accept patches (just send me whole updated files if you don't know how to create a patch file).

    /J

Re: Insert an image into a Word document
by yul (Initiate) on Jul 15, 2009 at 15:53 UTC
    Did you resole the problem? I have same. Let me now if yes, please.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found