0 Replies Latest reply on Jun 15, 2010 9:39 PM by amol bhandwale

    embed xls file in air application.

    amol bhandwale

      Hi,

       

      I am using the as3xls api for reading the xls file from air application.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
          <![CDATA[
              import mx.controls.Alert;
              import com.as3xls.xls.Sheet;
              import com.as3xls.xls.ExcelFile;
              [Embed(source='MATERIAL.csv', mimeType='application/octet-stream')]
              private var xls:Class;
              private var sheet:Sheet;
              public function readXLS():void
              {
                  try
                  {
                      var excelFile:ExcelFile = new ExcelFile();
                      excelFile.loadFromByteArray(new xls());
                      sheet = excelFile.sheets[0];
                      grid.dataProvider = sheet.values;
                  }
                  catch(err:Error)
                  {
                      Alert.show("Exception in uploading a file." + err.getStackTrace());
                  }
              }
          ]]>
      </mx:Script>
          <mx:Panel height="325" width="638" horizontalCenter="0" verticalCenter="0">
              <mx:Button label="load" click="readXLS();" />
              <mx:DataGrid id="grid"
                      width="100%"
                      sortableColumns="false"
                      draggableColumns="false" height="100%">
              </mx:DataGrid>
          </mx:Panel>
      </mx:WindowedApplication>

       

       

      this program read the xls file, but i want the user can select a xls file through file browse function and embeded file dynamically to read the content.

       

      How to embeded the xls file dynamically.

       

      Is their any other way to read a xls file in air application.

       

      Thanks,

      Amol.