"Open in Excel": Another AIR 2 Mini Sample

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.

Installation Instructions

  1. Download the AIR 2.0 beta runtime here.
  2. Download AIR2Excel.air here.
  3. Double-click AIR2Excel.air in Explorer or Finder to start the installation process.

Comments

  1. Nathan says:

    WOW.. This is what I’m waiting for the long…

    Thanks Christophe… AIR Rocks.. ;)

  2. Wow. Thanks for article.

  3. vivian says:

    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!

  4. vivian says:

    oh,…actually, I worked it out. :)

  5. Oleg says:

    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.

  6. Claire says:

    Just what I was looking for – many thanks

  7. Scott says:

    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.

  8. Jeff Boothe says:

    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

  9. Chinmay says:

    Hi,

    Is there any way i can read an Excel file in AIR?

    Thanks,
    Chinmay

  10. thats what i want.
    thanks alott

  11. Daniel says:

    Hi,
    Thanks for sharing.
    I have done some research about export data to excel file for a while.Right now, it seems that the project as3xls could not support export data to excel file with formula and format.I would apprecaite if you could give some suggestion about how to implement that functionality with formula and format.

    Thanks,
    Regards!
    liu,meng-meng

  12. thats what i want.
    thanks alott

  13. srinath says:

    Hi,
    Thanks for sharing,
    How to read the header data.

    Thanks,
    Srinath

  14. srinath says:

    How to export grouped datagrid to Excel

    Thanks
    Srinath

  15. Tom says:

    Where can I find the source code for this application?

  16. cypress says:

    Thanks. someone saved my life :D

  17. medyum says:

    thank you very nice excel very good

  18. Always in Stock, Lowest Prices, Huge Selection, and Super Fast Shipping. Cherokee Workwear, Studio B, BabyPhat, Scrubs HQ, Team Scrubs,Dickies Scrubs, Skechers scrubs, Tooniforms, Zone Clogs,Skechers shoes and Avia.

  19. maternity medical uniforms

  20. cheap scrubs with free shipping

  21. Medion Akku says:

    WOW.. This is what I’m waiting for the long…

  22. rehan says:

    Nice work

    Could u let me know how can i import 2007 excel file

  23. Clay says:

    Is it possible to export an image to excel through as3xls?

  24. Great summary of what it is really like – it’s not perfect, but with a little creativity and help from the employer – it is a great step to providing the best nutrition and protection to our children. I work as a lactation consultant in Northern California and many of the companies we work work are on board already. Its a short term commitment for a huge long term gain. Thanks for your post.

  25. excellente bilhadiar de tambo y tucos con ditistamo camemo. orinho a lario y nônetos escremes con movoxu olard!

  26. nona says:

    Thnx Nice work
    Where can I find the source code for this application?

  27. thats what i want.
    thanks alott

  28. Paul says:

    This is great. Is there a way to also include the column titles, as a CSV file would do?

Trackbacks

  1. [...] Christophe Coenraets Rich Internet Applications, Flex, AIR, Java Skip to content BioUsing Flex with Spring « “Open in Excel”: Another AIR 2 Mini Sample [...]

  2. [...] “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. [...]

  3. [...] 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 [...]

Speak Your Mind

*