Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Copying Charts from Microsoft Excel to microsoft word

by rohit1994 (Initiate)
on Feb 11, 2016 at 13:10 UTC ( [id://1154949]=perlquestion: print w/replies, xml ) Need Help??

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

hey, I'm new to perl, and i have been trying to learn the wide applications of it. the one thing that i have been trying from past few days is to copy specific charts or graphs from an excel file to a word file. I have browsed through a lot of contents on the web, but nothing seems to work. Can you please help me out there??

Replies are listed 'Best First'.
Re: Copying Charts from Microsoft Excel to microsoft word
by ww (Archbishop) on Feb 11, 2016 at 13:25 UTC

    Have your efforts (if one counts having "browsed through a lot of contents on the web [without useful results]" as a serious effort) showed you how to:

    1. open (and read) a file?
    2. Any of the ways to deal with excel files?
    3. What a resource CPAN is... in this case re MS Word?

    And did your research include reading How do I post a question effectively? or any of the other FAQS about PM?

    P.S. You may also find our Tutorials helpful.


    Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
    1. code
    2. verbatim error and/or warning messages
    3. a coherent explanation of what "doesn't work actually means.
       
Re: Copying Charts from Microsoft Excel to microsoft word
by GotToBTru (Prior) on Feb 11, 2016 at 13:21 UTC

    What have you tried so far? What modules in CPAN have you looked at? If you aren't familiar with CPAN, now would be a good time to learn :)

    I am not familiar with this kind of thing, but there would be two avenues that immediately suggested themselves:

    1. Use a module designed for Excel to open the spreadsheet, select the chart as an object, and pass that to a Word document opened with its appropriate module
    2. Using a module intended to simulate user interaction with Windows, open the spreadsheet and copy the chart into the clipboard, and paste it into the Word document

    But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

Re: Copying Charts from Microsoft Excel to microsoft word
by dasgar (Priest) on Feb 11, 2016 at 21:50 UTC

    The only way that I can think of doing this would need a Windows system with Microsoft Office and Perl installed. In that scenario, you should be able to use Win32::OLE to be able to control Excel and Word via the OLE API.

    The Win32::OLE module does have an OLE browser that you can use to try to figure out details about OLE objects (methods and properties). Personally, I've only gotten the browser code to work with using ActiveState's ActivePerl. Since the copyright of the module is owned by ActiveState, that might be the reason why.

    The general technique for figuring out how to use Win32::OLE to automate office applications is to records a macros that does the desired task and then port that VB code into Perl code. In your situation, the task involves two different office applications, which could make this technique a bit more tricky to do. But I personally would probably still try this technique to see if it would help out.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-28 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found