PHP_XLSXWriter icon indicating copy to clipboard operation
PHP_XLSXWriter copied to clipboard

Set header height: solution

Open NitemareReal opened this issue 5 years ago • 2 comments

Hello, this library is very good but have some important lacks, very, very, very easy to implement. First lack is that I can't find any documentation about this library, just some examples, too simple and with lots of undocumented options (I had to do a lot of reverse ingeneering to find out how to use some options).

I found too that you can't give a row height for header, but solution is very very easy, you have to modify a little code to get that feature.

Locate "writeSheetHeader" function and after:

if (!$suppress_row)
{
	$header_row = array_keys($header_types);

replace:

$sheet->file_writer->write('<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="' . (1) . '">');

with:

$ht = isset($col_options['height']) ? floatval($col_options['height']) : 12.1;
$customHt = isset($col_options['height']) ? true : false;
$sheet->file_writer->write('<row collapsed="false" customFormat="false" customHeight="'.($customHt).'" hidden="false" ht="'.($ht).'" outlineLevel="0" r="' . (1) . '">');

That's all!! so simple!! you can set header height.

I have found too much lacks that are too simple to implement... it's unbelievable

NitemareReal avatar Oct 06 '20 15:10 NitemareReal

Great, thx!

uhlyarikp avatar Nov 30 '20 11:11 uhlyarikp

Hello, to increase compatibility (Excel 2007), change:

$customHt = isset($col_options['height']) ? true : false;

with:

$customHt = isset($col_options['height']) ? "true" : "false";

NitemareReal avatar Nov 30 '20 12:11 NitemareReal