Friday, January 12, 2007

Latex note: convert Excel charts to eps files

This tip applies to any chart from MS Office.

In short, in order to insert charts from Excel to your Latex document, you need to (1) print your chart from MS Office into an eps file; (2) modify the bounding box in the output.

You need to install Generic Postscript Printer from Adobe first. Link the printer to the port FILE: . After installation, set its output option from Property -> Printing preferences... -> Advanced -> Postscript options -> Postscript output opion to encapsulated postscript format (eps).

This printer can be used to print the chart to an eps file.

The EPS file contains borders which defines where the chart is. Use postscript to open this EPS file, then use a text editor to open it simultaneously. Tick options -> eps clip from postscript. Then edit the line %%BoundingBox: ... from the text editor. Adjust the size of the chart in eps so that the clip fits well to the chart. Then save EPS.

Now you are done. Insert the chart into latex!

13 comments:

ardyanovich said...

hi, hopefully you still will read this. I just wanted to know where one can obtain a Generic Postscript Printer. Is there a website you can refer me to?

Jim Tan said...

There is two software you can convert your pdf to excel, check it out at:
1. www.investintech.com
2. www.cogniview.com

ninja_kampung said...

Hi Yue Zhang,

Thanks for your tips, it solved my problem, hope u don't mind i cite your post to my blog. http://utmthesis.blogspot.com/ and http://simon5u.blogspot.com/

Unknown said...
This comment has been removed by the author.
Unknown said...

Great tip. The cropping didn't work for me though.
Another posibility if you have Adobe Illustrator, is to just copy the chart in Illustrator. Illustrator recognizes it as a 100% vector graphic. And you can simply save it as EPS.

Unknown said...

Dear Yue Zhang,

Thanks so much for the great advice on how to put an Excel chart into an EPS file - it did the trick!

- Beth Ebert, Bureau of Meteorology

Seth Fogarty said...

After a lot of trail and error, I get the best results from the following:

(1) Use Microsoft's "Save as PDF" and Excel 2007 to save as a PDF file. This will save the active chart.

(2) Use "pdftops -eps 'file'.pdf" to convert to an eps file. This seems to compute a good bounding box. I am currently using Miktex's pdftops.

I hope this helps.

Burnstone said...

Most important for me was select adobe generic postscript printer(free driver), output to EPS.

Then use GSview (freeware), PS=>EPS with automatic BoundingBox.

fine!

Unknown said...

great tip, thanks

RZ said...

Converting excel charts to eps:

The Adobe generic postscript printer (free driver) cannot be installed on Windows Vista, etc. (unlike XP, etc). Here's a summary of my solutions. I hope it saves you hours of fixing this problem:

Method 1:
1. save the chart as PDF in excel.
2. then use pdftops tool: c:\Users\TEST»"c:\Program Files\MiKTeX 2.8\miktex\bin\pdf2ps.exe" input.pdf output.eps


Method 2:
1. save the chart as PDF in excel
2. use a free website to convert the PDF to EPS, such as: http://pdf.my-addr.com/free-online-pdf-to-eps-convert.php


Method 3:
1. Install a generic commercial printer provided by Microsoft: http://office.microsoft.com/en-us/publisher/hp062079971033.aspx
2. Change the options of the printer to output as EPS
3. Simply print to an EPS file whatever you wish
4. If the boundaries are not right, try to fix it with GSview:

4.1. Open the eps file
4.2. Choose "PS to EPS", but uncheck the option for automatically calculate bounding box
4.3. Correct the bounding box
4.4. Save your output

Enjoy! :D

Unknown said...

I use pdflatex which requires pdf images to generate pdf files. Here is what I did.

1. Use Excel 2007 and Save As PDF, as explained here to generate a PDF of the excel chart.

2. This creates a PDF file but the boundaries are too big. You can use pdftops to convert a PDF file with the large boundaries into a PDF file with the correct boundaries. No need to convert it to eps and then back to pdf.

Unknown said...

You can simply :
1. Save your chart in .pdf from Excel
2. Import your .pdf with Inkscape. Feel free to do what you want : minimize your chart (File>Properties>Page) and edit the bounding box, modify text, save to .svg (implemented in LyX), save a copy to .eps (if needed for LaTeX), etc.

No need to use any other tools...

Khan said...

Hi friends You can download Some Best Business card Designs here
Free Business cards Templates Download