When all this is said and done and we are happy with what we have produced ( and so is the business of course ) they seem to inevitably come back with “This report is great, any chance I can get it in excel?”
As per usual it was required ASAP. We already write out several reports into excel but each report is different and I was after a generic solution. I was directed to this article by Dale Fraser: http://www.cflex.net/showfiledetails.cfm?ObjectID=298
Which didn’t really work and had a few issues not surprising it was for Flex 1. Plus I felt that all the HTML was unnecessary and I was after a cleaner simpler solution. I didn’t want to restrict the use to IE either so the js was to go aswell. What I came up with was a solution that loops the datagrid columns ( hidden and seen ) and produces a tab separated block of text that will paste into excell perfectly separating the grid columns into nice excel columns. It even takes into consideration label functions. The accountants where happy and could now paste into excel with 1 click and manipulate the data in anyway they want.
You can see an example of this where I grab the rss feed from fullasagoog and tidy it up a bit and put it in a grid. Let the grid load up, click copy, open excel, click in a cell and paste. It works on mac and windows ( I’ll assume linux my desktop is at home so I cant test ) in ie, safari and firefox.
I also enabled code view.