foreach ($keys as $key) {
$c++;
- if($field[$key]['type'] !== 'hidden') {
- $columns = max($columns, $c);
- $cell = $sheet->getCellByColumnAndRow($c, $line);
- $cell->setValue($key);
- $style = $sheet->getStyleByColumnAndRow($c, $line);
- if(!$field[$key]['editable'] || $field[$key]['type'] === 'noteditable') {
- $style->getProtection()->setLocked(Protection::PROTECTION_PROTECTED);
- $style->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('dddddd');
- }
- $style->getFont()->setBold(true);
- $style->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
+ $columns = max($columns, $c);
+ $cell = $sheet->getCellByColumnAndRow($c, $line);
+ $cell->setValue($key);
+ $style = $sheet->getStyleByColumnAndRow($c, $line);
+ if(!$field[$key]['editable'] || $field[$key]['type'] === 'noteditable') {
+ $style->getProtection()->setLocked(Protection::PROTECTION_PROTECTED);
+ $style->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('dddddd');
}
+ $style->getFont()->setBold(true);
+ $style->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
}
for ($i = 0; $i < sizeof($settings); $i++) {
$line++;
foreach ($keys as $key) {
$columns = max($columns, $c);
- if (array_key_exists($key, $settings[$i]) && $field[$key]['type'] !== 'hidden') {
+ if (array_key_exists($key, $settings[$i])) {
$value = $settings[$i][$key] ?? "";
$value = is_array($value) ? json_encode($value) : $value;
$sheet->getCellByColumnAndRow($c, $line)->setValue($value);
$style = $sheet->getStyleByColumnAndRow($c, $line);
- if(!$field[$key]['editable'] || $field[$key]['type'] === 'noteditable') {
+ if(!$field[$key]['editable'] || $field[$key]['type'] === 'noteditable' || $field[$key]['type'] === 'hidden') {
$style->getProtection()->setLocked(Protection::PROTECTION_PROTECTED);
$style->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('dddddd');
}