“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.
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • StumbleUpon
  • Twitter
This entry was posted in Air, Flex. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

10 Comments

  1. Nathan
    Posted November 24, 2009 at 10:59 pm | Permalink

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

    Thanks Christophe… AIR Rocks.. ;)

  2. Posted December 5, 2009 at 8:21 pm | Permalink

    Wow. Thanks for article.

  3. vivian
    Posted December 9, 2009 at 12:37 pm | Permalink

    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
    Posted December 9, 2009 at 1:36 pm | Permalink

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

  5. Oleg
    Posted December 20, 2009 at 7:14 pm | Permalink

    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. Posted February 12, 2010 at 4:31 pm | Permalink

    Just what I was looking for – many thanks

  7. Scott
    Posted February 19, 2010 at 2:43 pm | Permalink

    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
    Posted March 2, 2010 at 9:36 am | Permalink

    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
    Posted March 10, 2010 at 4:28 am | Permalink

    Hi,

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

    Thanks,
    Chinmay

  10. Posted March 11, 2010 at 2:16 am | Permalink

    thats what i want.
    thanks alott

4 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. By andy.edmonds.be › links for 2009-12-04 on December 4, 2009 at 7:36 pm

    [...] “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. By AIR 2.0 Web Server using the New Server Socket API on December 8, 2009 at 1:56 pm

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

  4. [...] Christophe Coenraets – Open in Excel [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>