How can I copy a graph in excel and paste it into word?
Show older comments
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 Comments
per isakson
on 12 Jun 2016
Edited: per isakson
on 12 Jun 2016
Thomas Lee
on 12 Jun 2016
Muhammad Usman Saleem
on 12 Jun 2016
send some example data in excel?whether your figure is in gpeg or graph format in excel?
Thomas Lee
on 12 Jun 2016
Muhammad Usman Saleem
on 12 Jun 2016
then it will be difficult to proccess. You have to activate your excel file, then copy image and have to provide safe as in word.
I recommend you to safe this image in gpeg then make a copy paste in word.
"I recommend you to safe this image in gpeg then make a copy paste in word."
What? No! An excel graph object is a lot more than just a picture. a) you'd loose the ability to edit the graph, b) you're going from a vectorial format to a raster format so you'd loose the ability to resize the graph (without it looking horribly wrong), c) it's only a few lines of code anyway.
It's jpeg by the way.
Muhammad Usman Saleem
on 12 Jun 2016
thanks, but, for testing i try to read excel file with a line graph in it. xlsread giving an empty variable. That why i recommend. In word he has to adopt non-editable format of image
Marc
on 12 Jun 2016
Why would you do this? Seriously? Let's say you have 70mb of data stuck in Excel AND you have Matlab.... Just grab the data in excel and plot the stuff in Matlab. Then you can use the publish functions of Matlab to automate reporting. If you have the excel add on toolbox, you can highlight data, right click and send it right over to Matlab for plotting. I guess I am baffled why you would ever do this IF you have Matlab? Seems like an awfully expensive thing to do since VBA and Microsoft can already talk to each other.
Thomas Lee
on 12 Jun 2016
Marc
on 13 Jun 2016
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.
Answers (3)
Guillaume
on 12 Jun 2016
1 vote
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.
Image Analyst
on 13 Jun 2016
1 vote
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.
For Word, see these answers from the Mathworks: http://www.mathworks.com/matlabcentral/answers/?sort=relevance&term=microsoft+word+source%3A%22MathWorks+Support%22
Muhammad Usman Saleem
on 12 Jun 2016
Edited: Guillaume
on 12 Jun 2016
0 votes
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!