title: Dojo data grid to Excel file
body: <p>I have a question about exporting dojo data grid to excel file. I have made it work with csv file using the dojo exporter and some php code. However, how do I make it to save as excel file. I now about pear and some other libraries, but there has to be similar solution to the one I am using for the csv. Also, when I create my own exporter in dojo, does it need to have something more specific then  the code I am using for the csv exporter. Also, what do I need to change in the php code to make it save as xls. The code is below. Thanks a lot in advance. </p>
  
  <p>My dojo exporter:</p>
  
  <pre><code>function exportCsv(){
      var g = dijit.byId("grid");
      g.exportGrid("csv",{
                  writerArgs: {
                      separator: ","
                  }
                  }, function(str){
  
  
                          var form = document.createElement('form');
                          dojo.attr(form, 'method', 'POST');
                          document.body.appendChild(form);
                          dojo.io.iframe.send({
                                  url: "csv.php",
                                  form: form,
                                  method: "POST",
                                  content: {exp: str},
                                  timeout: 15000
                          });
                          document.body.removeChild(form);
  
                          }); 
  }
  </code></pre>
  
  <p>My php code working with csv:</p>
  
  <pre><code>&lt;?
  
  $time = time();
  header("Pragma: public");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Content-type: application/csv");
  header("Content-Disposition: attachment; filename=\"grid_$time.csv\"");
  $exportedData = $_POST['exp'];
  
  
  echo stripslashes($exportedData);
  exit;
  ?&gt; 
  </code></pre>