Extracting a chart as an image

How do I obtain the current snapshot of a chart in an Excel spreadsheet - as an image? 

PNG/BMP etc?

I see there is
XlsFile.GetChart.GetImage

But from reading the documentation, that doesn't look like it's the same thing I'm looking for.

Thanks

Hi,

The main issue here is that currently FlexCel will only extract the images from xls, not xlsx files. (Rendering xlsx charts is a feature planned for FlexCel 7, but we don't have an ETA for that yet).

 If you have an xls file, you can use xls.RenderObject to get the image (Chart.GetImage will return images inserted inside the chart, it is not something you want here). There is a demo "45.Render Objects" which shows a chart rendered from an xls file into a bitmap, which is displayed inside a Delphi form. Take a look at it, it shows how you can get the chart image.

Thanks Adrian, looks like I'll be eagerly awaiting v7!

All the best.

Just foind out that GetImage is not the only thing not working for XLSX files. Deleting series doesn't work either. Well, when can we expect FlexCel 7 then?



Another note: The documentation should tell me that! I've been digging for hours through the help without an idea why I can't delete a series. The help doesn't mention "Doesn't work with XLSX files" at all.

Hi,
Sorry, but indeed AddSeries or DeleteSeries won't work indeed in
xlsx. No API from the XlsChart object is yet implemented for xlsx files.
Charts are preserved and series will adapt when you insert or delete
rows, but that is currently the support for xlsx charting.

About
the docs, it might be indeed that it doesn't mention that xlsx files are
not supported. What happens is that the documentation is huge (about
4900 pages in the last release), and it is difficult to update. I have
particularly spend the last 2 months basically updating all the docs,
removing obsolete information, adding new examples, etc.

But this
all takes an incredible amount of time, time that could be spent
developing the missing features instead of documenting that they aren't
implemented. Specially if after they are implemented you have to review
all docs again to remove the parts that said that this wasn't
implemented.

Originally, when xlsx was released we supported 0
methods from it, so updating every method to say "doesn't support xlsx"
would have meant updating about 5000 pages. But soon, basic xlsx support
was implemented, and we would have to have reupdate the docs to remove
the info we had just added. So we've kept adding functionality to xlsx
and the docs have not always been updated first to say "not implemented
yet in xlsx", then to say "now implemented in xlsx". I agree it is not
the ideal, and I would love that every doc in every method and class is
up to date every time, but we have about 1600 classes and it isn't
really feasible without spending more time reviewing the docs than
working in the missing features. So in general I tend not to add
information to the docs that I know will be obsolete soon.

Right
now,  the only missing thing in xlsx is the chart support . While it is
documented in many places in the docs (and I am sure I won't be able to
update all the docs once we release this missing support to say it is
now implemented), it might well be that particular methods don't have
that information.

Again, sorry about that, but in this case I
think the time is better spent adding the missing functionality. FlexCel
7 is coming, even it did got a little delayed with the Linux support and
the full review of the docs that happened in the last months. There is still no ETA and it is
still some months away, but I hope not too far away. Full chart support is the only big missing thing in xlsx support, and I'd love to see it working as soon as possible.