PhpSpreadsheet/samples/Basic
oleibman e4e99b8a73
Permit Date/Time Entered on Spreadsheet to be Calculated as Float (#3121)
* Permit Date/Time Entered on Spreadsheet to be Calculated as Float

Fix #1416. I do not entirely understand the use case for this old issue, but resolving it seems straightforward. Issue complains that user-entered date/time fields may be interpreted as either float or int when PhpSpreadsheet reads them. Issue suggests getCalculatedValue treat all date/time fields as float; that seems like a breaking change. However, adding an option to permit it seems okay. That option might be implemented as either a property of Calculation, or a static property of Cell. Since the changed logic is found in Cell (and Shared/Date), I opted for the latter.

In Cell, the property `$parent` is incorrectly described in doc block as `Cells`, and should be `?Cells`. This change eliminates some Phpstan and Scrutinizer problems, and should allow the elimination of some try/catch blocks - I have not done an exhaustive search for those.

Calls to `isDateTime` could have affected activeSheet and selectedCells; they no longer can. Optional parameters are added to it and the functions it calls to accommodate the new functionality; the defaults for the new parameters will, of course, return the same result as the earlier versions of the functions would have returned.

* Scrutinizer - Self-inflicted

Tests used constant which I deprecated.
2022-10-18 18:58:38 -07:00
..
data/continents Merge all examples together 2017-10-01 17:48:59 +09:00
01_Simple.php Document Properties - Coverage and 32-bit-safe Timestamps (#2113) 2021-05-30 13:55:58 +02:00
01_Simple_download_ods.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
01_Simple_download_pdf.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
01_Simple_download_xls.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
01_Simple_download_xlsx.php Keep sample bootstrap purely in samples 2020-05-17 18:51:13 +09:00
02_Types.php Permit Date/Time Entered on Spreadsheet to be Calculated as Float (#3121) 2022-10-18 18:58:38 -07:00
03_Formulas.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
04_Printing.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
05_Feature_demo.php Merge all examples together 2017-10-01 17:48:59 +09:00
05_UnexpectedCharacters.php Special Characters in Image File Name (#2416) 2021-12-06 06:50:09 -08:00
06_Largescale.php Merge all examples together 2017-10-01 17:48:59 +09:00
07_Reader.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
08_Conditional_formatting.php Upgrade to latest PHP_CodeSniffer 2018-08-06 11:02:16 +09:00
08_Conditional_formatting_2.php Upgrade to latest PHP_CodeSniffer 2018-08-06 11:02:16 +09:00
09_Pagebreaks.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
11_Documentsecurity.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
12_CellProtection.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
13_Calculation.php PSR12 code style 2020-07-26 14:13:11 +09:00
13_CalculationCyclicFormulae.php PSR12 code style 2020-07-26 14:13:11 +09:00
14_Xls.php Merge all examples together 2017-10-01 17:48:59 +09:00
15_Datavalidation.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
16_Csv.php Fix for Issue 2042 (SUM Partially Broken) (#2045) 2021-05-03 18:31:01 +02:00
17_Html.php Merge all examples together 2017-10-01 17:48:59 +09:00
17a_Html.php Improve HTML Writer (#1464) 2020-05-18 12:43:18 +09:00
17b_Html.php Different Example for Callback 2020-06-09 00:22:22 -07:00
18_Extendedcalculation.php Rename classes to keep them in their related namespaces 2017-10-29 17:39:42 +09:00
19_Namedrange.php Two Problems with Sample19 2021-05-09 15:41:36 -07:00
20_Read_Excel2003XML.php Improving Coverage for Excel2003 XML Reader (#1557) 2020-10-11 13:26:56 +02:00
20_Read_Gnumeric.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Read_Ods.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Read_Sylk.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Read_Xls.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
22_Heavily_formatted.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
23_Sharedstyles.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
24_Readfilter.php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
25_In_memory_image.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
26_Utf8.php Fix Some Pdf Problems (#2960) 2022-07-29 06:14:28 -07:00
27_Images_Html_Pdf.php Copy from Xls(x) to Html/Pdf Loses Drawings (#2788) 2022-05-07 08:10:24 -07:00
27_Images_Xls.php Merge all examples together 2017-10-01 17:48:59 +09:00
28_Iterator.php Testing - Delete Temp Files When No Longer Needed (#1488) 2020-05-24 20:03:07 +09:00
29_Advanced_value_binder.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
30_Template.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
30_Templatebiff5.php Stacked Alignment - Use Class Constant Rather than Literal (#1716) 2021-02-03 23:53:04 +01:00
31_Document_properties_write.php Minor improvements (#1028) 2019-06-22 21:24:51 +02:00
31_Document_properties_write_xls.php Minor improvements (#1028) 2019-06-22 21:24:51 +02:00
37_Page_layout_view.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
38_Clone_worksheet.php Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
39_Dropdown.php Fix Sample39 (#2664) 2022-03-09 18:55:31 -08:00
40_Duplicate_style.php Additional conditionals from math trig (#1885) 2021-02-28 10:24:33 +01:00
41_Password.php Merge all examples together 2017-10-01 17:48:59 +09:00
42_RichText.php Improve Coverage for HTML Reader 2020-06-25 22:42:38 -07:00
43_Merge_workbooks.php Initial Formula Translation tests (#1886) 2021-02-28 13:18:51 +01:00
44_Worksheet_info.php Resolve Scrutinizer Reports for Samples (#2691) 2022-03-21 13:17:25 -07:00
45_Quadratic_equation_solver.php Changes to the default arguments for `htmlspecialchars()` and `html_entity_decode()` requires setting of the argument value explicitly to prevent changes in behaviour. (#2176) 2021-06-21 12:56:03 +02:00
46_ReadHtml.php Merge all examples together 2017-10-01 17:48:59 +09:00
47_xlsfill.php Fill Pattern Start and End Colors (#2444) 2021-12-18 08:53:23 -08:00
47_xlsxfill.php Fill Pattern Start and End Colors (#2444) 2021-12-18 08:53:23 -08:00
48_Image_move_size_with_cells.php Add editAs Property for 2-cell Anchor Drawings (#2674) 2022-03-16 16:12:38 -07:00
49_alignment.php Reconcile Differences between Css and Excel For Cell Alignment (#3048) 2022-09-09 07:34:36 -07:00