For instance to create an excel file (471K) takes about 6 minutes to process. I suppose there would be a way to speed up the creation of an excel file. Any pointers on how to achieve this will be helpful.
Note: I have dhtmlxSuite v2.5 pro 91111 edition.
Hi,
unfortunately exporting to excel at php is not really quick.
You may use export grid-html-php. It works like excel and provides excel file as a result, but actually it generates html-table, which may be opened with excel. Such way is really effective for huge datasets.
grid-html-php.zip (2.2 KB)
Thanks.
Trying this set of PHP wasn’t successful. Ran into following issues:
Notice: Undefined index: grid_xml in /generate-html.php on line 10
Warning: Cannot modify header information - headers already sent by (output started at /generate-html.php:10) in /grid_html.php on line 88
Warning: Cannot modify header information - headers already sent by (output started at /generate-html.php:10) in /grid_html.php on line 89
Warning: Cannot modify header information - headers already sent by (output started at /generate-html.php:10) in /grid_html.php on line 90
Notice: Trying to get property of non-object in /grid_html.php on line 16
Notice: Trying to get property of non-object in /grid_html.php on line 69
Warning: Invalid argument supplied for foreach() in /grid_html.php on line 71
Notice: Trying to get property of non-object in /grid_html.php on line 19
Warning: Invalid argument supplied for foreach() in /grid_html.php on line 157
Notice: Trying to get property of non-object in /grid_html.php on line 21
Note: I found another way, which does work, thought it does not produce fancy excel (does’t retain fonts, colors etc).
<?php .... // Original PHP code by Chirp Internet: http:// www. chirp.com.au // Please acknowledge use of this code by including this header. function cleanData(&$str) { // escape tab characters $str = preg_replace("/\t/", "\\t", $str); // escape new lines $str = preg_replace("/\r?\n/", "\\n", $str); // convert 't' and 'f' to boolean values if($str == 't') $str = 'TRUE'; if($str == 'f') $str = 'FALSE'; // force certain number/date formats to be imported as strings if(preg_match("/^0/", $str) || preg_match("/^\+?\d{8,}$/", $str) || preg_match("/^\d{4}.\d{1,2}.\d{1,2}/", $str)) { $str = "'$str"; } // escape fields that include double quotes if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"'; } // file name for download $filename = $_POST['fname'] . "-" . date('Ymd') . ".xls"; header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Type: application/vnd.ms-excel"); $flag = false; $query = $_POST['query']; $sth = $_oraDbConnection->query($query); while($sth->fetchInto($row, DB_FETCHMODE_ASSOC)) { // display field/column names as first row if(!$flag) { echo implode("\t", array_keys($row)) . "\r\n"; $flag = true; } array_walk($row, 'cleanData'); echo implode("\t", array_values($row)) . "\r\n"; } exit; ?>Please, provide your grid demo if still doesn’t work.
Long Path Tool could help you in this situation, for more info you may check PathTooDeep.
Good luck!