
In Adobe AIR 1.0 and 1.5, there were different options to “open” the data of a Flex DataGrid in Excel. For example, you could leverage the AIR native drag-and-drop support to drag rows from the DataGrid to an open Excel spreadsheet. You could also drag rows to the desktop (or anywhere on the file system) as an .xls file. These two approaches are demonstrated in my Salesbuilder sample application. Another approach was to use a server roundtrip to download the generated .xls file from the server and force Excel to open with the data.
There was however no immediate way to implement a straight (client-side only) “Open in Excel” feature (aka click a button to open your DataGrid data in Excel). With AIR 2.0 and the new File.openWithDefaultApplication() method this becomes extremely easy to implement. In the sample below, I provide an example of this new feature. The sample also supports the drag-and-drop approach from the AIR application to Excel and from the AIR application to the desktop (or anywhere else on the file system). This sample uses the as3xls library to create the Excel spreadsheet. View Source is enabled.


9 Comments
WOW.. This is what I’m waiting for the long…
Thanks Christophe… AIR Rocks.. ;)
Wow. Thanks for article.
Hi Christ,
When I run your salesbuilder-v2, I got several errors related to ilog.utils
such as:
Definition ilog.utils:GregorianCalendar could not be found.
Definition ilog.utils:TimeUnit could not be found
Could you let me know where I can find the ilog.utils package?
Thank you!
oh,…actually, I worked it out. :)
That is a nice sample. Is there any way to Read Excel file ?
Also, since Excel 2007 there is a new nice file format – XLSX, which is compressed XML file.
Any integration with that ? In fact, how can one read/write compressed files in AIR.
In addition, there is a Java API called Apache POI, which works with XLS and XLSX.
Any integration with that ?
TIA,
Oleg.
Just what I was looking for – many thanks
Trying to install the AIR2Excel.air file and getting the following error:
This application requires an update to Adobe AIR that is not available for your system.
Please view the system requirements for Adobe AIR and update your system accordingly.
I am running the latest Air 2 beta 2. Any idea?
Thanks.
Christophe,
It was great meeting you in Tampa last month.
Just wanted to see if you could update your example to work with AIR 2 beta 2.
Thanks,
Jeff Boothe
Hi,
Is there any way i can read an Excel file in AIR?
Thanks,
Chinmay
4 Trackbacks
[...] Christophe Coenraets Rich Internet Applications, Flex, AIR, Java Skip to content BioUsing Flex with Spring « “Open in Excel”: Another AIR 2 Mini Sample [...]
[...] “Open in Excel”: Another AIR 2 Mini Sample (tags: flex air as3 excel) This was written by andy. Posted on Saturday, December 5, 2009, at 1:35 am. Filed under Delicious. Bookmark the permalink. Follow comments here with the RSS feed. Post a comment or leave a trackback. [...]
[...] exploring Java integration using the new Native Process API (here and here), Excel integration using the new file.openWithDefaultApplication(), and the new Microphone API, here is another [...]
[...] Christophe Coenraets – Open in Excel [...]