I am trying to come up with an estimate for a project that involves creating automated PowerPoint reports based on a Microsoft Access database. It’s an extension of a project I already did for the client, with the major difference being that he wants two charts (based on data in the database) included in the new reports.
If I were doing this on *nix I would just pipe the data into gnuplot, save an image, and put the image into the PowerPoint programmatically. Is there any way to easily package gnuplot into a Visual Studio project so that the client doesn’t have to do any other kind of installations?
If not, or that would be more trouble than it’s worth, I’d appreciate any ideas of other ways to do this. Would using native PowerPoint charts be reasonable — i.e. is the data that they’re based on easily accessible programmatically?
Thanks in advance!
There are a couple ways of going about it using just what’s normally installed as part of MS Office. Which you choose will depend to some extent on which version of Office you’re writing for.
Given that most customers have very specific requirements for charts that don’t match up with the default charts supplied by Excel/PPT et al, you either need to insert a chart then do all the formatting under program control or, my preference, store pre-formatted specimen charts in a separate PPT/PPTX file or files. You can open this invisibly, copy/paste the chart into the current slide(s) as needed, then programatically modify the data.
One of the big advantages to this is that you (or the client if you choose to let them in on the trick) can change the formatting quickly and easily, w/o needing to change a line of code.
And circling back to your original question, the data in native PPT charts is easily accessible. A quick VBA example: