openspout icon indicating copy to clipboard operation
openspout copied to clipboard

$options->setColumnWidth() is one too small in resulting spreadsheet

Open bar9 opened this issue 3 years ago • 2 comments

Using v4.8.1:

I was setting column widths: $options->setColumnWidth(17,1); $options->setColumnWidth(4,2); $options->setColumnWidth(119,3);

the resulting widths in the spreadsheet were 16, 3 and 118 (each short by 1). I 'measured' with =CELL("width", A1)

bar9 avatar Nov 16 '22 10:11 bar9

A related bug: it seems that you can not do eg.

$options->setColumnWidth(17, 5);
$options->setColumnWidth(119,3);

It doesn't work for me unless I call this function, for each column in sequence , and in order :

$options->setColumnWidth(10, 1);
$options->setColumnWidth(20, 2);
// etc

So incidentally, I have to set explicitly a width for columns I'm not interested in - starting with column 1 - otherwise the width is applied to incorrect columns.

So if I do this

$options->setColumnWidth(10, 3);
$options->setColumnWidth(20, 4);
// etc

... it will set widths on columns 1 and 2

fabd avatar Nov 16 '22 21:11 fabd

Any PR is welcome

Slamdunk avatar Nov 16 '22 21:11 Slamdunk