From 9813e056c3736d014eac4e77ea4af6541b15f64a Mon Sep 17 00:00:00 2001 From: Vinicius Ferreira Date: Wed, 24 May 2017 21:06:05 -0300 Subject: [PATCH] Print subhead in reports --- xlsxwriter.class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xlsxwriter.class.php b/xlsxwriter.class.php index 444fc3073..a7e9bb893 100644 --- a/xlsxwriter.class.php +++ b/xlsxwriter.class.php @@ -137,22 +137,30 @@ protected function initializeSheet($sheet_name) $sheet->file_writer->write( ''); } - public function writeSheetHeader($sheet_name, array $header_types, $format = 'xlsx', $delimiter = ';') { + public function writeSheetHeader($sheet_name, array $header_types, $format = 'xlsx', $delimiter = ';', $subheader = NULL) { if (empty($sheet_name) || empty($header_types) || !empty($this->sheets[$sheet_name])) { return; } if ($format == 'csv') { $this->writeCSVLine($header_types, true, $delimiter); } + if (!empty($subheader)) { + $this->writeSheetRow($sheet_name, [' '], $format, $delimiter); + $this->writeSheetRow($sheet_name, [$subheader], $format, $delimiter); + $this->writeSheetRow($sheet_name, [' '], $format, $delimiter); + $start = 3; + } else { + $start = 0; + } self::initializeSheet($sheet_name); $sheet = &$this->sheets[$sheet_name]; $sheet->cell_formats = array_values($header_types); $header_row = array_keys($header_types); - $sheet->file_writer->write('