'header'=> "Thumbnail",
'dataIndex'=> 'id',
'width'=> 75,
- 'renderer' => array($this, 'getThumb')
+ 'renderer' => array($this, 'getThumb'),
+ * 'color' => 'yellow', // set color for the cell which is a header element
+ * 'fillBlank' => 'gray', // set the color for the cell which is a blank area
),
// if this is set then it will add a tab foreach one.
}
foreach($cfg['cols'] as $c=>$col_cfg) {
- $v = isset($cl[$col_cfg['dataIndex']]) ? $cl[$col_cfg['dataIndex']] : '';
+
+ if(isset($cl[$col_cfg['dataIndex']])){
+ $v = $cl[$col_cfg['dataIndex']];
+ }else{
+ if(isset($col_cfg['fillBlank'])){
+ $worksheet->write($start_row+$r, $c, '', $formats[$col_cfg['fillBlank']]);
+ }
+ continue;
+ }
+
if (empty($cl[$col_cfg['dataIndex']])) {
continue;
}
$v = @iconv('UTF-8', 'UTF-8//IGNORE', $v);
- $format = false;
- if(isset($col_cfg['format'])){
- $format = $formats[$col_cfg['format']];
- }
- if(isset($data['color'])){
- if($format === false){
- $format = $formats[$data['color']];
- }else{
- $format = array_merge($format,$formats[$data['color']]);
- }
- }
+ $format = isset($col_cfg['format']) ? $formats[$col_cfg['format']] : false;
+
$worksheet->write($start_row+$r, $c, $v, $format);
}
}