PhpSpreadsheet/tests/PhpSpreadsheetTests
oleibman 13b62becdd
Fix for Issue #1887 - Lose Track of Selected Cells After Save (#1908)
* Fix for Issue #1887 - Lose Track of Selected Cells After Save

Issue #1887 reports that selected cells are lost after saving Xlsx. Testing indicates that this applies to the object in memory, though not to the saved spreadsheet.

Xlsx writer tries to save calculated values for cells which contain formulas. Calculation::_calculateFormulaValue issues a getStyle call merely to retrieve the quotePrefix property, which, if set, indicates that the cell does not contain a formula even though it looks like one. A side-effect of calls to getStyle is that selectedCell is updated. That is clearly accidental, and highly undesirable, in this case. Code is changed to save selectedCell before getStyle call and restore it afterwards.

The problem was reported only for Xlsx save. To be on the safe side, test is made for output formats of Xlsx, Xls, Ods, Html (which basically includes Pdf), and Csv. For all of those, the object in memory is tested after the save. For Xlsx and Xls, the saved file is also tested. It does not make sense to test the saved file for Csv and Html. It does make sense to test it for Ods, but the necessary support is not yet present in either the Ods Reader or Ods Writer - a project for another day.

* Move Logic Out of Calculation, Add Support for Ods ActiveSheet and SelectedCells

Mark Baker thought logic belonged in Worksheet, not Calculation.
I couldn't get it to work in Worksheet, but doing it in Cell works,
and that has already been used to preserve ActiveSheet over call to
getCalculatedValue, so this just extends that idea to SelectedCells.

Original tests could not completely support Ods because of a lack of support
for ActiveSheet and SelectedCells in Ods Reader and Writer.
There's a lot missing in Ods support, but a journey of 1000 miles ...
Those two particular concepts are now supported for Ods.
2021-03-10 21:23:08 +01:00
..
Calculation Fix for Issue #1887 - Lose Track of Selected Cells After Save (#1908) 2021-03-10 21:23:08 +01:00
Cell Start refactoring the Lookup and Reference functions (#1912) 2021-03-10 21:18:33 +01:00
Chart Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
Collection Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
Custom Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
Functional Stacked Alignment - Use Class Constant Rather than Literal (#1716) 2021-02-03 23:53:04 +01:00
Helper Initial experiments using the new Database query logic with Conditional Statistical Functions (#1880) 2021-02-27 18:26:12 +01:00
Reader Fix for Issue #1887 - Lose Track of Selected Cells After Save (#1908) 2021-03-10 21:23:08 +01:00
Shared Minor scrutinizer improvements (#1906) 2021-03-07 14:22:03 +01:00
Style Statistical refactoring - Confidence() and Trend() (#1898) 2021-03-04 21:45:56 +01:00
Worksheet Bugfix #1858; Apply stricter scoping rules to named range/cell access (#1866) 2021-02-19 22:03:50 +01:00
Writer Fix for Issue #1887 - Lose Track of Selected Cells After Save (#1908) 2021-03-10 21:23:08 +01:00
DefinedNameFormulaTest.php Improve Coverage in src/PhpSpreadsheet 2020-11-27 06:50:01 -08:00
DefinedNameTest.php Changes for Scrutinizer 2020-11-27 07:16:23 -08:00
DocumentGeneratorTest.php Improve Coverage in src/PhpSpreadsheet 2020-11-27 06:50:01 -08:00
IOFactoryTest.php Changes for Scrutinizer 2020-11-27 07:16:23 -08:00
NamedFormulaTest.php Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
NamedRangeTest.php Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
ReferenceHelperTest.php Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
SettingsTest.php fixed php8 deprecation warning for libxml_disable_entity_loader() (#1625) 2020-10-08 15:02:14 +02:00
SpreadsheetTest.php Fix for 1735 (Incorrect activeSheetIndex after RemoveSheetByIndex) (#1743) 2020-12-10 18:01:08 +01:00