How can I copy a graph in excel and paste it into word?

3 次查看(过去 30 天)
I would like to copy a graph I made in an Excel file (there is only one graph in a file) and paste it onto a single Word file.
Instead of opening an excel file and pasting it onto a word file manually, I am trying to do this using MATLAB.
Can anyone help me do this? It seems like a relatively simple task but I'm not much of a MATLAB person.
Thank you.
  10 个评论
Thomas Lee
Thomas Lee 2016-6-12
Hello,
The chart can end up in word as an image, no issue there.
Marc:
As to why I want to do this, I have an many excel files with extensive calculations already done - which is why these files are so large. They have become very slow - almost 5 minutes to open, copy the chart into word as image, and close the file.
The graph is quite involved as it has jittering with layers of data with particular formatting and I would not want to reproduce the same graph in matlab when they are already produced in excel.
If it seems VBA would work better, I will look into it.
Marc
Marc 2016-6-13
Good luck... In my experience, excel only gets bulkier and in many cases kills computers. I work with data historians and people like to dump endless streams of second by second data into them... Useless.
Regardless, getting your data out of excel, running the calcs and plotting the results in Matlab is way better than coming up with some macro to keep the data stuck in excel. In my experience, a 70mb .mat file loads in Matlab effortlessly and you can quickly set up what if scenarios.
Bite the bullet, do yourself and the future of humanity a favor... Recreate the calcs in Matlab, allowing you to use an endless amount of functions/tools to improve you work processes.

请先登录,再进行评论。

回答(3 个)

Guillaume
Guillaume 2016-6-12
This is not really a matlab question as the code you'd write in matlab would be the same VBA code you'd write in Excel / Word to do the same thing. Plus, if it's just one graph it'd be faster to do it manually anyway.
In the end you've got to use Excel and Word object model. Probably the best way for you to find what the code should be would be to record a macro in excel where you copy the graph, and record a macro in word where you paste. The code in the macro would be the same you'd write in matlab.

Image Analyst
Image Analyst 2016-6-13
You can control both Excel and Word with ActiveX. I attach an example of how to communicate with Excel. You can do the same thing with Word. Basically the easy way to do it is to record a macro in Excel or Word and then edit the macro to see what it did. Then copy those lines of code to MATLAB. You may have to make a few slight modifications but at least you find out the methods you need to call.

Muhammad Usman Saleem
编辑:Guillaume 2016-6-12

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by