3 Replies Latest reply on Oct 24, 2006 5:58 PM by chris.huston.t10

    Exporting Data to Excel Sheet

    <<Squall>>
      Hello...
      I would like to know if there's any possibility to export data from a datagrid to an excel sheet

      thanks in advance for your early reply
        • 1. Re: Exporting Data to Excel Sheet
          schjlatah
          I don't think there is. From what I know of the security restrictions that we must work within, we don't have access to the local filesystem.
          If you wanted to be ghetto about it, you could demand that everyone download your swf and run it on their local machines (that must all be running IIS) and have them all host a webservice that you could publish to, that would (upon consumption) generate an xls file. But that may be a bit much for saving a file.
          • 2. Re: Exporting Data to Excel Sheet
            ntsiii Level 3
            Depending on what you actually require, there are several solutions.

            Search the archive here, and Google.

            Tracy
            • 3. Re: Exporting Data to Excel Sheet
              chris.huston.t10 Level 3
              My solution is to call a PHP page that creates a comma delimited version of the datagrid data. I then use the file download feature in Flex to save the data to the user's computer. There are probably more elegant solutions, but it gets the job done.

              public function save_data():void {
              var request:URLRequest = new URLRequest();
              request.url = " http://yourserver/php_convert_script.php";
              request.method = URLRequestMethod.POST;
              var params:URLVariables = new URLVariables();
              // If your datagrid data comes is loaded from a database, you could just call the data that way instead of sending
              the data from flex.
              params.some_variable_to_send = datagrid_data;
              request.data = params;
              fileToDownload = new FileReference();
              fileToDownload.download(request, "datagrid_data.csv");
              }

              Vygo