Hi,
I need a sheet with two rows followed by a table. This table has a header with filter.
This is what it should look like:
You can see the table header with filtering active in row 3.
But table filtering only works for me without the rows above the table.
As soon as I add the two rows using $writer->writeSheetRow() then the table header no longer shows filter option.
I'm using the 2023-06-02 release.
This is the code for the table only with correct set filter:
$writer = new XLSX_Writer();$sheetName = 'TEST';$rowFormat = ['height' => 20, 'font-size'=>10];$formatList = ['col1'=>'string', 'col2'=>'string'];$colOptions = ['auto_filter' => true, 'freeze_rows' => 1, 'suppress_row' => false];$writer->writeSheetHeader($sheetName, $formatList, $colOptions);$writer->writeSheetRow($sheetName, ['aaa', 'bbb'], $rowFormat);$writer->writeSheetRow($sheetName, ['ccc', 'ddd'], $rowFormat);$writer->writeToFile($file);
But when I try to insert the two rows above the table, then the filtering is no longer active in the table header.
As far as I know I need to write another header for inserting rows above a table, so my code looks like this:
$writer = new XLSX_Writer();$colOptions = ['suppress_row' => true];$writer->writeSheetHeader($sheetName, ['string'], $colOptions);$writer->writeSheetRow($sheetName, ['HEAD'], ['height' => 30, 'font-size'=>20,'font-style'=>'bold']);$writer->writeSheetRow($sheetName, ['SUBHEAD'], ['height' => 30, 'font-size'=>14,'font-style'=>'bold']);$rowFormat = ['height' => 20, 'font-size'=>10];$formatList = ['col1'=>'string', 'col2'=>'string'];$colOptions = ['auto_filter' => true, 'freeze_rows' => 1, 'suppress_row' => false];$writer->writeSheetHeader($sheetName, $formatList, $colOptions);$writer->writeSheetRow($sheetName, ['aaa', 'bbb'], $rowFormat);$writer->writeSheetRow($sheetName, ['ccc', 'ddd'], $rowFormat);$writer->writeToFile($file);
Hi, I need a sheet with two rows followed by a table. This table has a header with filter. This is what it should look like:
You can see the table header with filtering active in row 3.
But table filtering only works for me without the rows above the table. As soon as I add the two rows using
$writer->writeSheetRow()
then the table header no longer shows filter option. I'm using the 2023-06-02 release.This is the code for the table only with correct set filter:![table](https://github.com/mk-j/PHP_XLSXWriter/assets/22832625/73ffc00c-4d33-4a45-8cca-957a18edff31)
$writer = new XLSX_Writer();
$sheetName = 'TEST';
$rowFormat = ['height' => 20, 'font-size'=>10];
$formatList = ['col1'=>'string', 'col2'=>'string'];
$colOptions = ['auto_filter' => true, 'freeze_rows' => 1, 'suppress_row' => false];
$writer->writeSheetHeader($sheetName, $formatList, $colOptions);
$writer->writeSheetRow($sheetName, ['aaa', 'bbb'], $rowFormat);
$writer->writeSheetRow($sheetName, ['ccc', 'ddd'], $rowFormat);
$writer->writeToFile($file);
But when I try to insert the two rows above the table, then the filtering is no longer active in the table header. As far as I know I need to write another header for inserting rows above a table, so my code looks like this:
$writer = new XLSX_Writer();
$colOptions = ['suppress_row' => true];
$writer->writeSheetHeader($sheetName, ['string'], $colOptions);
$writer->writeSheetRow($sheetName, ['HEAD'], ['height' => 30, 'font-size'=>20,'font-style'=>'bold']);
$writer->writeSheetRow($sheetName, ['SUBHEAD'], ['height' => 30, 'font-size'=>14,'font-style'=>'bold']);
$rowFormat = ['height' => 20, 'font-size'=>10];
$formatList = ['col1'=>'string', 'col2'=>'string'];
$colOptions = ['auto_filter' => true, 'freeze_rows' => 1, 'suppress_row' => false];
$writer->writeSheetHeader($sheetName, $formatList, $colOptions);
$writer->writeSheetRow($sheetName, ['aaa', 'bbb'], $rowFormat);
$writer->writeSheetRow($sheetName, ['ccc', 'ddd'], $rowFormat);
$writer->writeToFile($file);
The result is:
No filtering anymore.
Any hints? Thanks Hyper