Next
Update
Prev
Excel Export
xlsx xls
Data Only

You can export data to a Excel File by using the KoolGrid API, excelExportSave() and any server-side script (such as ASP, PHP, etc). Click the Export button and check the exported file.

function excelExport() {
  dataGrid.exportOnlyData = inputForm.dataOnly.checked;
  
  for (var i = 0; i < inputForm.export_type.length; i++) {
    if (inputForm.export_type[i].checked) {
      dataGrid.exportType = inputForm.export_type[i].value;
      break;
    }
  }
  dataGrid.exportFileName = "export." + dataGrid.exportType;
  
  gridRoot.excelExportSave("https://www.koolchart.com/koolgrid/server/saveExcel.php", false);
}

[saveExcel.php]
<?php
/*
 * This PHP code is to show how to decode and save the excel file.
*/

  $fileName = $_REQUEST['fileName'];
  $j = 0;
	
  $data_length = 0;
  $data_byte = "";
	
  header("Content-Type: application/octet-stream");
  header('Content-Disposition: attachment; filename="' . $fileName . '"');
	
  while (true) {
    $data = $_REQUEST["fileData" . $j];
    $data_length += strlen($data);
    if ($data != null && $data_length > 0) {
      $data_byte = base64_decode($data);
      echo $data_byte;
      $j++;
    } else
      break;
  }
?>

© 2017 KoolChart. All rights reserved.