Difference between revisions of "How to save an Excel chart directly to an image file"

From CCoWS Wiki
Jump to: navigation, search
(New page: Its very handy to be able to convert Excel charts directly to image files, so you can do things like post the on wiki pages. The best format for this is PNG, since it handles fonts, lines...)
(No difference)

Revision as of 15:00, 20 February 2009

Its very handy to be able to convert Excel charts directly to image files, so you can do things like post the on wiki pages.

The best format for this is PNG, since it handles fonts, lines, and images all at once. Formats like GIF, BMP, and JPG are not as good, because they only store images, and the convert fonts and lines to ugly looking images before saving them. PDF is ok, but not as versatile for rapid viewing and thumbnailing on web pages, or embedding in other documents.

There are many ways to do export from Excel charts to images.

Option 1

This is perhaps the best option.

  1. In Excel:
    1. Select the chart
    2. Select Save As
    3. Change file type to "Web page (*.htm)"
    4. Change options to save "Selection"
    5. Enter file name "tmp.htm"
    6. Select OK, or Publish or whatever is needed to say you're done.
  2. Then, in Windows Explorer:
    1. Look for tmp.htm
    2. Look for a folder in the same place called "tmp_files"
    3. Look for image files in that folder, preferably the PNG, since this will be best quality
      1. If no PNG appears, apparently there's some web save options that will change this.
    4. Put the PNG where you need it
    5. Delete tmp.htm (this wil also delete the tmp_files folder

Option 2

Write a script to do it:

Sub export() fileSave = Application.GetSaveAsFilename( _ InitialFileName:="xlchart.png", _ fileFilter:="PNG File (*.png), *.png,GIF File (*.gif), *.gif") If fileSave <> False Then ActiveChart.export fileSave, Right(fileSave, 3) End If End Sub

This is from http://www.bogleheads.org/forum/viewtopic.php?t=639&sid=defa2b6c9c83f466e05de8ec2c66b3de

I haven't tried it, but it looks very promising for geeky types.

Option 3

Save to PDF, and then save PDF as PNG. Not bad, but requires that you manually crop your image out of the PDF page.

Option 4

Copy and paste to image program like Paint or PhotoShop. Ugly, because it rasterizes the fonts and lines.