Flex datagrids and Excel part 2

by 4:02 AM 21 comments
A few moths ago I write a post on extracting data from a flex datagrid see: HERE

I had several people contact me about this regarding extending functionality or how to get it into a file. At the time I was asked to implement the function the customer wanted it into the clipboard hence the copy/paste method I produced but I didn't think about how easy it would be to extend this to a downloadable file.

John Gag mentioned a method he uses which didn't quite work when I had date formatters. We currently generate many excel spreadsheets using HTML formatting to color code excel but I wanted a simpler version with no formatting/colors. Excel will automatically populate cells based on TAB delimited strings so I used my original method with a few changes and simply posted this back to Coldfusion ( or in this case Railo ) or PHP. ( I tested this in OSX with Excel, Windows with Excel and Ubuntu with Open Office and they all worked ).



View source is enabled: http://demo.kukiel.net/flex/copy/srcview/index.html

Demo: http://demo.kukiel.net/flex/copy/

And below is the CFML and PHP.
CFML:


PHP:


Now I'm sure this method could apply to asp, pl or any other server side language I just made it for the 2 I have available. The great thing about this method is that I can send any tab delimited data from a grid as a POST to my server without having to customize server side code in anyway.

The data being displayed in the grid comes directly from Full as a goog