3

How do i export an Excel chart to a PNG image, defining the exact size of the resulting image file?

I need to export some excel charts to PNG to put them on a html page. Due to design restrictions, there's a maximum width (say, 450px) for those PNGs. I've already found a lot of instructions how to export the charts to PNG, but in every case, i had to resize the resulting PNG down to the target dimensions, loosing quality. Is there a way to make Excel use certain dimensions when exporting a chart?

Ways i've tried to create the PNGs:

I'm using Office 2010 currrently.

EDIT:

Modifying the size of the charts inside the Excel file would make it possible to "predict" the resulting PNG image size, but it would be great if there's a way of setting the image size without resizing the chart itself, e.g. to create PNGs with different, but pre-defined sized based on the same chart.

EDIT 2:

There's a useful tool named XL toolbox that allows to "publish" charts with a defined print size using pt, mm or in. This isn't exactly what i'm needing, since the tool seems to resize the image, too, with a slight loss of quality.

2
  • 1
    This would be great, but it's not practical. If the original charts need to be a particular size in Excel for some reason, and this doesn't match the size you need to export, then make a second set that is the right size for exporting. Mar 1, 2015 at 2:17
  • Or resize the Excel charts, export them, then revert them to their original size. Mar 23, 2015 at 21:03

2 Answers 2

1

When I export from Excel, my .png images are about 1" = 151px.

To get a perfect 450px wide image, I set my Chart width to 2.99" (direct enter the value on the Width box on the Format Tab).

To verify, paste into MS Picture Manager and check the size setting summary. Then adjust as necessary. FWIW, my Excel 2007 on a different box behaves slightly different, but they are both internally consistent-so I only had to figure out my measurements once per machine.

1
  • Thanks dav for your reply - but this isn't exactly what i'm needing. I've edited my answer....
    – tohuwawohu
    Feb 27, 2015 at 15:12
1

Here are a couple tutorials with some VBA code that will export a chart as an image file: Export Chart as Image File and Enhanced Export Chart Procedure.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .