You are here

protected function Xls::setConditionalFormating in Excel Serialization 8

Sets conditional formats on worksheet.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheet: The sheet to set the conditional formats on.

array $conditional_styles: The conditional formats to set.

Throws

\PhpOffice\PhpSpreadsheet\Exception

1 call to Xls::setConditionalFormating()
Xls::encode in src/Encoder/Xls.php
Encodes data into the given format.

File

src/Encoder/Xls.php, line 431

Class

Xls
Adds XLS encoder support for the Serialization API.

Namespace

Drupal\xls_serialization\Encoder

Code

protected function setConditionalFormating(Worksheet $sheet, array $conditional_styles) {
  $highest_data_column = $sheet
    ->getHighestDataColumn();
  $highest_data_row = $sheet
    ->getHighestDataRow();
  $current_conditional_styles = $sheet
    ->getStyle('A2')
    ->getConditionalStyles();
  $conditional_styles = array_merge($current_conditional_styles, $conditional_styles);
  $sheet
    ->getStyle('$A$2:$' . $highest_data_column . '$' . $highest_data_row)
    ->setConditionalStyles($conditional_styles);
}