Commit Graph

2146 Commits

Author SHA1 Message Date
Jon Link 14d807c2c4 BUGFIX for issue #1161 (#1328)
Removed broken unused code that tried to set a constant multiple times.

Fixes #1161
Closes #1328
2020-01-24 06:40:30 +01:00
Mark Baker 83a50537b2
Return type docblock fixes (#1305)
* Return type docblock fixes
2020-01-04 22:17:40 +01:00
MarkBaker f8cfff058f Update ChangeLog 2020-01-04 18:55:03 +01:00
oleibman 082266aacd Conditionals - Extend Support for (NOT)CONTAINSBLANKS (#1278)
Support for the CONTAINSBLANKS conditional style was added a while ago.
However, that support was on write only; any cells which used
CONTAINSBLANKS on a file being read would drop that style.

I am also adding support for NOTCONTAINSBLANKS, on read and write.
2020-01-04 18:50:04 +01:00
oleibman 1c6dd8923e Handle Error in Formula Processing Better for Xls (#1267)
* Handle Error in Formula Processing Better for Xls

When there is an error writing a formula to an Xls file,
which seems to happen when a defined name is part of a formula,
the cell is currently left blank. A better result would be to
write the calculated value of the formula.

* Making Changes Suggested in Review

Per comment from Mark Baker:
   1. Made return codes from writeFormula into constants.
   2. Skipped redundant call to getCellValue when possible.
   3. Added support for bool type, adding additional tests
      for bool and string.
Per comment from PowerKiki:
   1. Used standardized convention for assigning file name in test.
      Since before this change, save would throw Exception, I kept
      the unlink for the file in tearDown.
2020-01-04 18:34:21 +01:00
Mark Baker 1b2c99b190
Initial unit test for locale floats (#1304)
* Initial unit test for locale floats
This will require potential modification of the TravisCI environment to support other locales

* var_dump to check output on TravisCI

* Fix assertions for double/float and with/without line reference

* Style in unit test
2020-01-04 18:09:46 +01:00
MarkBaker 596aecab68 Update changelog 2020-01-04 00:32:27 +01:00
oleibman afd070a756 Handle ConditionalStyle NumberFormat When Reading Xlsx File (#1296)
* Handle ConditionalStyle NumberFormat When Reading Xlsx File

ReadStyle in Reader/Xlsx/Styles.php expects numberFormat to be a string.
However, when reading conditional style in Xlsx file, NumberFormat
   is actually a SimpleXMLElement, so is not handled correctly.
While testing this change, it turned out that reader always expects
   that there is a "SharedString" portion of the XML, which is not
   true for spreadsheets with no string data, which causes a
   run-time message.
Likewise, when conditional number format is not one of the built-in
   formats, a run-time message is issued because 'isset' is used
   to determine existence rather than 'array_key_exists'.
The new workbook added to the testing data demonstrates both those
   problems (prior to the code changes).

* Move Comment to Resolve Conflict

Github reports conflict involving placement of one comment statement.

* Respond to Scrutinizer Style Suggestion

Change detection for empty SimpleXMLElement.
2020-01-04 00:10:41 +01:00
Mark Baker ed78a02119
Addition cell datatype tests (#1303)
* Additional cell datatype unit tests

* Codestyle appeasement
2020-01-03 23:44:38 +01:00
Mark Baker e19228ecb0
Additional cell datatype unit tests (#1301) 2020-01-03 23:29:53 +01:00
Mark Baker 0417c8cc2b
Fix date tests withut specified year for current year 2020 (#1302) 2020-01-03 23:24:45 +01:00
Markus Salmijärvi ab4c6602cf Fix Xlsx Writer's handling of decimal commas (#1282)
Perform the comma -> period substitution in Xlsx Writer writeCell()
before checking if the decimal value has a period in it. The previous
behavior led to decimals of the form "1,1" to become "1.1.0".
2020-01-03 22:34:10 +01:00
Adrien Crivelli 9fab8900ef
Use latest available Ubuntu 2019-12-19 11:44:12 +01:00
Adrien Crivelli a163d9d1ab
Coverage with PCOV instead of xdebug
Because it is much, much faster than xdebug
2019-12-19 11:43:55 +01:00
Mark Baker 4b6ad77690
Modify Travis to use 7.4 rather than 7.4snapshot now that 7.4 has bee… (#1291)
* Modify Travis to use 7.4 rather than 7.4snapshot now that 7.4 has been released

* Try upgrading from Trusty to Xenial to see if --with-zip is enabled on that image
2019-12-14 16:53:06 +01:00
Adrien Crivelli 1648dc9ebe
1.10.1 2019-12-02 00:13:51 +01:00
Guilherme Capanema 144a0cabbc
Get plotVisOnly and dispBlanksAs props from chart in Xlsx Chart Writer.
These chart properties where hardcoded in the Xlsx writer, ignoring the
values passed to the \PhpOffice\PhpSpreadsheet\Chart\Chart class constructor.

I also changed the default $displayBlanksAs value to 'gap' to match this
document:
https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/1942c028-3c4e-4dd9-a379-b12a9b7914df

Closes #1266
2019-12-01 00:51:38 +01:00
milkyway d61855effe
ODS writer prevent invalid numeric value if locale decimal separator is comma
Closes #1268
2019-11-30 16:33:19 +01:00
Adrien Crivelli ad37da8a5d
Missing changelog
#1263
2019-11-30 16:23:03 +01:00
rtek cf30c2a824
Modify XLSX RW to keep decimal for floats with a zero decimal part
Prior to 1.10, all numeric values where read as floats. In 1.10
numeric values are read using 0 + x, which relies on PHP type
juggling rules. As a result, float(0.0) is written as string('0'),
then read back as int(0). This fix causes the writer to retain the
the decimal for float values such that a reader can differentiate
floats from ints.

Closes #1262
2019-11-30 16:15:48 +01:00
Owen Leibman 9552172b85
Do not confuse defined names and cell refs
CALCULATION_REGEXP_CELLREF is not sufficiently robust.
It treats some perfectly legal defined names, e.g. A1A, as cell refs.
When the Xlsx Writer tries to save a worksheet which uses such a name
in a formula in a cell, it throws an exception.

The new DefinedNameConfusedForCellTest is a simple demonstration.
The Regexp has been changed to ensure the name starts on a Word boundary,
and to make sure it is not followed by a word character or period.
This fixes the problem, and does not appear to cause any regression
problems in the test suite.

Closes #1263
2019-11-30 16:10:43 +01:00
coolhub 86fa5424a6
Correct column style even when using rowspan
Closes #1249
2019-11-30 15:40:42 +01:00
Ikko Ashimine cc92c6648e
FLOOR() function accept negative number and negative significance
Closes #1245
2019-11-30 15:18:04 +01:00
Adrien Crivelli 9fa45f7e48
PHP 7.4 compatibility 2019-11-30 00:12:46 +01:00
Adrien Crivelli f734783d82
1.10.0 2019-11-18 12:33:05 +01:00
Robert Doering 6a2e0cef43
Read xlsx files with exotic workbook names like "workbook2.xml"
Some auto generated xlsx files are using other names as workbook than "workbook.xml".
This is fixed by supporting names of workbooks by regex `/workbook.*\.xml/`.

Closes #1183
2019-11-17 21:53:09 +01:00
Roland Eigelsreiter e5409f0fed fix access error
Fix the error "Trying to access array offset on value of type null"
2019-11-17 21:47:31 +01:00
Rinat Gumirov 7f5e0f0a37 Add test for PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension 2019-11-17 21:19:50 +01:00
Adrien Crivelli 5435fe8025
Move Changelog entry 2019-11-17 21:18:53 +01:00
Adrien Crivelli 256e5ad0e7 Code style 2019-11-17 21:17:56 +01:00
Nathanael d. Noblet 22bf54ca11 Allow Html Reader to write into existing spreadsheet
Sometimes you may want to read html into multiple worksheets within one
spreadsheet. Allowing the passing of a spreadsheet in makes this possible.
2019-11-17 21:17:56 +01:00
Paul Blacknell 788f79c1bb
Validate XIRR inputs and return correct error values
Fix: Return #NUM! if values and dates contain a different number of values
Fix: Return #NUM! if there is not at least one positive cash flow and one negative cash flow
Fix: Return #NUM! if any number in dates precedes the starting date
Fix: Return #NUM! if a result that works cannot be found after max iteration tries
Fix: Correct DocBlocks for XIRR & XNPV
Add: Validate XIRR with unit tests

Closes #1177
2019-11-17 21:17:12 +01:00
Dennis Holst 3fc2fa47de Check for existing xf index in mapping array before accessing it 2019-11-17 21:09:28 +01:00
Adrien Crivelli b636c56d7f
Code style 2019-11-17 21:03:47 +01:00
Jorge Casas 156ab360fe
Fixed Functions->ifCondition for allowing <> and empty condition
In cells with formulas containing conditions like `=IFSUM(A1:A3;"";B1:B3)`
to sum cells from range A1:A3 with empty value in range B1:B3, the function
`Functions::ifCondition()` create in this case the code `=""""` instead of
`=""`, so it didn't work.

Closes #1206
2019-11-17 21:03:11 +01:00
Jerome3 b20f5c1d11
Fix ODS Reader when no DC namespace are defined
ODS files without spreadsheet properties were triggering a fatal error

Fixes #1047
Fixes #1176
Closes #1182
2019-11-17 20:57:53 +01:00
Rinat Gumirov 7e1bf823cc Add ReferenceHelper::cellSort and ReferenceHelper::cellReverseSort tests 2019-11-17 20:50:55 +01:00
Rinat Gumirov 82b3a36ab7 Style fix 2019-11-17 20:48:34 +01:00
Rinat Gumirov 73c79a90a8 Add PhpOffice\PhpSpreadsheet\Cell\DataType::checkString unit test 2019-11-17 20:48:34 +01:00
Rinat Gumirov f2bba73510 Add test for IOFactory::load 2019-11-17 18:39:38 +01:00
Fräntz Miccoli 445cc18e39
Fix IF implementation to comply with Excel behavior
Closes #1165
2019-11-17 18:26:33 +01:00
Adrien Crivelli 86bb4f9356
Change license from LGPL 2.1 to MIT
Fixes #140
2019-11-17 18:08:34 +01:00
Adrien Crivelli 5ec0e333dd
Fix code style 2019-11-17 17:44:02 +01:00
Diego Souza 157b6e75e4
useless parentheses 2019-11-17 17:40:20 +01:00
Diego Souza fac1d6de14
unnecessary string concatenation 2019-11-17 17:40:09 +01:00
Diego Souza ba735e21d6
combined assignment operator 2019-11-17 17:39:59 +01:00
Diego Souza d2cb2a0d1a
fixes UselessVariable and UnusedVariable from slevomat/coding-standard 2019-11-17 17:39:42 +01:00
Fräntz Miccoli 75dfcb5a36
Fix branch pruning resolution of non boolean conditions
Closes #1167
2019-11-10 22:59:09 +01:00
Adrien Crivelli 5441b2fa73
Keep big integer as integer instead of lossely casting to float
Closes #874
Fixes #1135
2019-11-10 22:51:53 +01:00
Adrien Crivelli d7d67ff39b
More explicit column index as string
Fixes #951
2019-11-10 20:58:20 +01:00