I want to change a data in a cell on export excel. But the event does not appear to occur. My php version is 5.3.3. The export take the filename only. It's my php version? thank!
$grid["export"] = array("format"=>"xls", "filename"=>"my-file", "heading"=>"Export to Excel Test", "range" => "filtered");
$e["on_render_excel"] = array("custom_export", null, false);
$g->set_events($e);
// custom on_export callback function
function custom_export($param)
{
$objPHPExcel = $param["phpexcel"];
$arr = $param["data"];
// column formatting using phpexcel
for($r=1;$r<=count($arr);$r++)
{
$cell = $r+1;
$data = 'Client: '.$arr[$r]["id"];
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue("C$cell","test");
}
}
Perhaps, you need to set 3rd param to true.
$e["on_render_excel"] = array("custom_export", null, true);
This will continue default export operation after you function.
As your function does not complete export code, it should be true.
I try with "true" and nothing change. I received a excel file but the data of column C is not change.
You can then make 3rd param to false, and then put complete implementation inside function.
e.g.
https://gist.github.com/gridphp/70e96ee4f0225e2a6af2f76b672b2abf