Chart.Export max pixel size?

D

Dan

A week or so ago I posted concerning a utility program that can create
a GIF file from any picture or bitmap copied to the clipboard. The
clipboard copy might be of a range, shape, chart, or anything else.
As almost always happens, no sooner had I uploaded the program than I
read a tip in another thread that I could have used. In this case it
was Jon Peltier showing how it is much simpler to just do a
Sheets(1).ChartObjects.Add(Left, Top, Width, Height)
to add an embedded chart, rather than mimicking the macro recorder
method of adding a new separate chart sheet, relocating the chart back
to a worksheet, then resizing and repositioning the chart. (Thank you
Jon, and thanks again to Harald Staff, David McRitchie, and Stephen
Bullen.)

I've updated the utility program and have also added the ability to
save in GIF, JPEG, or PNG format. Available for free at
www.qsl.net/ac6la/. But that's not the reason for this post.

I'm trying to get more info on an Excel limitation (?) concerning the
max pixel size of a file created with the Chart.Export method. When
running on a machine with Windows Me and a 19 inch display with
graphics card "A", the maximum dimensions of the export file are 1238
by 1238 pixels. This is true for any of the 3 filters (GIF/JPEG/PNG),
under both XL97 and XL2000, and for several different screen
resolutions (1024x768, 1280x1024, etc). However, on another machine
running Windows XP Home and a 17 inch display with graphics card "B",
the max seems to be 874 x 894 pixels when I have the screen resolution
set to 800 x 600, but is 1119 x 1144 pixels when I set the display to
1024 x 768. (To create these large images I typically do a PrtScrn to
copy the desktop, then use the utility program to create a 2x
enlargement. Then I open the resulting file with Photo Editor and see
where it got clipped.)

Can anyone shed any light on this? I'd like to be able to alert the
user when an exported file has been clipped. (Without reading the
file back in, if possible.)

Thanks,
Dan
 
J

Jon Peltier

Dan -

I have experienced this clipping of large exported chart images. I
believe it's related to the truncation of images when Excel ranges or
charts are copied and to the cropping of objects pasted into PowerPoint.
Long ago I tried to sort out the details; I seem to recall that copying
as a picture, using the picture option (metafile) not the bitmap option,
produced the largest possible images without cropping. The issue with
pasting into PowerPoint is covered on the PPT FAQ page:

http://www.rdpslides.com/pptfaq/FAQ00068.htm

- Jon
 
D

Dan

Jon,

Thanks for the feedback. Maybe I'll look into what it would take to
read back at least the header info of the exported file to see what
the pixel size is, so that I can warn the user if anything got
clipped. Anybody know where I might start looking to find out the
(binary?) format for GIF, JPEG, and PNG files?

And thanks again for the ChartObjects.Add tip.

Dan
 
J

Jon Peltier

Dan -

You can probably find an API to read the pixel dimensions of the image
files.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top