i already use it:
<?php
use \koolreport\excel\PivotTable;
$sheet1 = "Finance Daily Report";
?>
<meta charset="UTF-8">
<meta name="title" content="Finance Daily Report">
<div sheet-name="<?php echo $sheet1; ?>">
<?php
$allStylesArray = [
'font' => [
'name' => 'Calibri', //'Verdana', 'Arial'
'size' => 30,
'bold' => false,
'italic' => FALSE,
'underline' => 'none', //'double', 'doubleAccounting', 'single', 'singleAccounting'
'strikethrough' => FALSE,
'superscript' => false,
'subscript' => false,
'color' => [
'rgb' => '000000',
'argb' => 'FF000000',
]
],
'alignment' => [
'horizontal' => 'general',//left, right, center, centerContinuous, justify, fill, distributed
'vertical' => 'bottom',//top, center, justify, distributed
'textRotation' => 0,
'wrapText' => false,
'shrinkToFit' => false,
'indent' => 0,
'readOrder' => 0,
],
'borders' => [
'top' => [
'borderStyle' => 'none', //dashDot, dashDotDot, dashed, dotted, double, hair, medium, mediumDashDot, mediumDashDotDot, mediumDashed, slantDashDot, thick, thin
'color' => [
'rgb' => '808080',
'argb' => 'FF808080',
]
],
//left, right, bottom, diagonal, allBorders, outline, inside, vertical, horizontal
],
'fill' => [
'fillType' => 'none', //'solid', 'linear', 'path', 'darkDown', 'darkGray', 'darkGrid', 'darkHorizontal', 'darkTrellis', 'darkUp', 'darkVertical', 'gray0625', 'gray125', 'lightDown', 'lightGray', 'lightGrid', 'lightHorizontal', 'lightTrellis', 'lightUp', 'lightVertical', 'mediumGray'
'rotation' => 90,
'color' => [
'rgb' => 'A0A0A0',
'argb' => 'FFA0A0A0',
],
'startColor' => [
'rgb' => 'A0A0A0',
'argb' => 'FFA0A0A0',
],
'endColor' => [
'argb' => 'FFFFFF',
'argb' => 'FFFFFFFF',
],
],
];
$styleArray = [
'font' => [
'italic' => true,
'color' => [
'hex' => 'a83234',
]
],
];
?>
<div>Finance Daily Report</div>
<div>Summary
<div>
<?php
PivotTable::create(array(
"dataSource" => $this->dataStore('F100'),
'hideSubTotalRows' => true,
'hideSubTotalColumns' => true,
'hideGrandTotalRow' => true,
'hideGrandTotalColumn' => true,
"showDataHeaders" => true,
'map' => array(
'rowField' => function($rowField, $fieldInfo) {
return $rowField;
},
'columnField' => function($colField, $fieldInfo) {
return $colField;
},
'dataField' => function($dataField, $fieldInfo) {
// Util::prettyPrint($fieldInfo);
return $dataField;
},
'dataHeader' => function($dataField, $fieldInfo) {
// Util::prettyPrint($fieldInfo);
return $dataField;
},
'waitingField' => function($waitingField, $fieldInfo) {
return $waitingField;
},
'rowHeader' => function($rowHeader, $headerInfo) {
// Util::prettyPrint($headerInfo);
$v = $rowHeader;
if (isset($headerInfo['childOrder']))
$v = $headerInfo['childOrder'] . ". " . $v;
return $v;
},
),
'excelStyle' => array(
'dataField' => function($dataFields) use ($styleArray) {
return $styleArray;
},
'dataHeader' => function($dataFields, $fieldInfo) use ($styleArray) {
return $styleArray;
},
'columnHeader' => function($header, $headerInfo) use ($styleArray) {
return $styleArray;
},
'rowHeader' => function($header, $headerInfo) use ($styleArray) {
return $styleArray;
},
'dataCell' => function($value, $cellInfo) use ($styleArray) {
return $styleArray;
},
)
));
?>
</div>
</div>
<div>Detailed
<div>
<?php
PivotTable::create(array(
"dataSource" => $this->dataStore('F200'),
'hideSubTotalRows' => true,
'hideSubTotalColumns' => true,
'hideGrandTotalRow' => true,
'hideGrandTotalColumn' => true,
"showDataHeaders" => true,
'excelStyle' => array(
'dataField' => function($dataFields) use ($styleArray) {
return $styleArray;
},
'dataHeader' => function($dataFields, $fieldInfo) use ($styleArray) {
return $styleArray;
},
'columnHeader' => function($header, $headerInfo) use ($styleArray) {
return $styleArray;
},
'rowHeader' => function($header, $headerInfo) use ($styleArray) {
return $styleArray;
},
'dataCell' => function($value, $cellInfo) use ($styleArray) {
return $styleArray;
},
)
));
?>
</div>
</div>
</div>