We will support all properties of Excel Table/PivotTable/PivotMatrix when exporting a datastore directly to excel in the next version. Meanwhile, you could try this method:
1 . Open the file koolreport/excel/ExportHandler.php
and replace the following lines:
$config['sheets'][] = [
'name' => $name,
'contents' => [
[
'type' => $type,
'dataSource' => $dataStore
]
]
];
with these ones:
$content = array_merge(Util::get($options, $name, []), [
'type' => $type,
'dataSource' => $dataStore
]);
$config['sheets'][] = [
'name' => $name,
'contents' => [ $content ]
];
2 . Then in your export page use this command:
$report
->run()
->exportToExcel([
"dataStores" => [
"orders" => [
"filtering" => function($row, $index) {
if (stripos($row['customerName'], "Baane Mini Imports") !== false)
return false;
return true;
},
"sorting" => ['dollar_sales' => 'desc'],
"paging" => [5, 2],
"showHeader" => false, //default: true
"showBottomHeader" => true, //default: false
"showFooter" => true, //default: false
"map" => [
"header" => function($colName) { return $colName; },
"bottomHeader" => function($colName) { return $colName; },
"cell" => function($colName, $value, $row) { return $value; },
"footer" => function($colName, $footerValue) { return $footerValue; },
],
"excelStyle" => [
"header" => function($colName) {
return [
'font' => [
'italic' => true,
'bold' => false,
'color' => [
'rgb' => '808080',
]
],
];
},
"bottomHeader" => function($colName) { return []; },
"cell" => function($colName, $value, $row) {
return [
'font' => [
'italic' => true,
'color' => [
'rgb' => '808080',
]
],
];
},
"footer" => function($colName, $footerValue) { return []; },
]
]
]
])
->toBrowser("MyReport.xlsx");
Let us know the result. Tks,