You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [X] a bug report
- [ ] a feature request
- [X] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
Inserting rows should not break page breaks.
What is the current behavior?
Inserting rows changes the behaviour of the page breaks.
What are the steps to reproduce?
Please use the following demonstration file : demo_break.xlsx
When running the script that simply adds a line the page breaks have changed in Excel.
There is an added page break that is not present on the initial file. This is a comparison picture (generated file is on the left, initial file is on the right).
As you can see there is only an added line on line 397, and the page break initially between line 417 and 418 correctly moved to between line 418 and 419, but there is a new break between line 451 and 452 which never existed before. If I use this document and print it as PDF the result will not respect the initial page breaks.
I've tried to find the cause of the issue and from what I can see the biggest change that happened after this is that the page breaks are not in the initial order in the array obtained by getBreaks on the spreadsheet.
The order is changed in the following way (first line is before the insertNewRow, second line is after)
A92 A184 A276 A368 A417 A511 A554
A92 A184 A276 A368 A555 A512 A418
The modified page breaks are presents but their order is inverted. The solution seems to have this array in the proper order or at least saved in the correct order as when I added in my code a change to get all the breaks, remove them all, and then recreated them in the correct order resulting in the second line being properly ordered, that added break is not present anymore. So that seems to be the issue.
What features do you think are causing the issue
Reader
Writer
Styles
Data Validations
Formula Calculations
Charts
AutoFilter
Form Elements
Which versions of PhpSpreadsheet and PHP are affected?
At least from 1.25 to 1.28
The text was updated successfully, but these errors were encountered:
oleibman
added a commit
to oleibman/PhpSpreadsheet
that referenced
this issue
May 5, 2023
FixPHPOffice#3552. Inserting rows or columns can cause page break arrays to be out of order. Sort them in Worksheet functions getBreaks, getRowBreaks, and getColumnBreaks before returning to caller.
Fix#3552. Inserting rows or columns can cause page break arrays to be out of order. Sort them in Worksheet functions getBreaks, getRowBreaks, and getColumnBreaks before returning to caller.
This is:
What is the expected behavior?
Inserting rows should not break page breaks.
What is the current behavior?
Inserting rows changes the behaviour of the page breaks.
What are the steps to reproduce?
Please use the following demonstration file :
demo_break.xlsx
With this snippet :
When running the script that simply adds a line the page breaks have changed in Excel.
There is an added page break that is not present on the initial file. This is a comparison picture (generated file is on the left, initial file is on the right).
As you can see there is only an added line on line 397, and the page break initially between line 417 and 418 correctly moved to between line 418 and 419, but there is a new break between line 451 and 452 which never existed before. If I use this document and print it as PDF the result will not respect the initial page breaks.
I've tried to find the cause of the issue and from what I can see the biggest change that happened after this is that the page breaks are not in the initial order in the array obtained by getBreaks on the spreadsheet.
The order is changed in the following way (first line is before the insertNewRow, second line is after)
A92 A184 A276 A368 A417 A511 A554
A92 A184 A276 A368 A555 A512 A418
The modified page breaks are presents but their order is inverted. The solution seems to have this array in the proper order or at least saved in the correct order as when I added in my code a change to get all the breaks, remove them all, and then recreated them in the correct order resulting in the second line being properly ordered, that added break is not present anymore. So that seems to be the issue.
What features do you think are causing the issue
Which versions of PhpSpreadsheet and PHP are affected?
At least from 1.25 to 1.28
The text was updated successfully, but these errors were encountered: