-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
This is:
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
when reading - do not set xml attribute showGridlines from element sheetView to true when xml attribute gridlinesSet from element printOptions is true
What is the current behavior?
when reading - xml attribute showGridlines from element sheetView is set to true when xml attribute gridlinesSet from element printOptions is true
What are the steps to reproduce?
Just read any xlsx file saved in a way that has gridlines invisible for sheetView (showGridLines="false") and contains printOptions element with attribute gridLinesSet="true"
e.g. in sheet1.xml
...
<sheetView showGridLines="false" showRowColHeaders="1" tabSelected="0" workbookViewId="0" zoomScale="55" zoomScaleNormal="55">
<selection activeCell="B17" sqref="B17"/>
</sheetView>
...
...
<printOptions gridLines="false" gridLinesSet="true" headings="true" horizontalCentered="false" verticalCentered="false"/>
...after reading this file, the result created with phpspreadsheet will allways have showGridLines="true" in sheetView
and it is because of this part of code in reader (mainly the first "if" block) https://github.com/PHPOffice/PhpSpreadsheet/blob/1.6.0/src/PhpSpreadsheet/Reader/Xlsx.php#L880-L885
and according to some specification i've found, the code highlighted should change into this:
if (self::boolean((string) $xmlSheet->printOptions['gridLines']) && self::boolean((string) $xmlSheet->printOptions['gridLinesSet'])) {
$docSheet->setPrintGridlines(true);
}Which versions of PhpSpreadsheet and PHP are affected?
phpspreadsheet 1.6.0
any php version
Specification that i've found can be downloaded here https://www.iso.org/standard/71691.html
and contains
...
gridLines (Print
Grid Lines)
Used in conjunction with gridLinesSet. If both gridLines and gridlinesSet are true , then
grid lines shall print. Otherwise, they shall not (i.e., one or both have false values).
The possible values for this attribute are defined by the W3C XML Schema boolean
datatype.
gridLinesSet (Grid
Lines Set)
Used in conjunction with gridLines. If both gridLines and gridLinesSet are true , then
grid lines shall print. Otherwise, they shall not (i.e., one or both have false values).
The possible v
...
so nothing about sheetView, but only about printing
- I'm not 100percent sure if I'm right - but it makes sense to me - so if you do not use some other specification for open xml formats for xlsx...