Andi Gutmans has <a href="http://andigutmans.blogspot.com/2005/09/automatic-salesforce-excel-reports.html">a new post on his blog today about his <a href="http://salesforce.com/">Salesforce.com dreamforce conference talk.
The real interesting part of this example is actually how to create the Excel graphs. Probably one of the easier ways to do that is to use Visual Basic from within Excel. However, as at Zend we want to do everything with PHP, and there are advantages of automating the process from the server, our challenge was how to actually create the Excel files from PHP.
In my talk I showcased two features of PHP 5, the new SOAP extension and the rewritten COM extension. The example I used is a script that creates an Excel report (with graph), of the geographic distribution of Salesforce leads.
He links over to the code examples on this one, showing not only how to use the COM extension to create the files, but also add graphs to those files.
The only somewhat useful reference is the Excel Visual Basic CHM (called VBAXL10.CHM), however, a lot of those features don't map directly into COM, nor are the constant values of the graph types listed in the docs, so you have to do a lot of guess working to actually get it working. We literally had to guess the constant ids for creating the various Excel graphs.
If you'd like to see the entire project at work (complete with the SOAP backend to grab the information), you can seen the example at http://gutmans.org/SF_COM_example.php.




