Commit Graph

345 Commits

Author SHA1 Message Date
Mark Baker 6c25b6f422
Refactor Xlsx Properties Reader code into a separate class (#1001)
* Unit tests for refactoring Spreadsheet properties
* Refactor Xlsx Properties Reader code into a separate class
2019-06-10 16:44:55 +02:00
MarkBaker d6018a273e Codestyle fixes in tests.... spawn of the devil 2019-05-30 12:23:25 +02:00
MarkBaker 9ba96efc97 Still test against 5.6, but with allowed failures, and skip tests explicitly for features that require PHP >= 7.0.0 2019-05-30 12:11:49 +02:00
kraser 906bdc613c Fix failure when parsing xlsx with drawing having double (redefined) … (#945)
* Fix failure when parsing xlsx with drawing having double (redefined) attributes

* Fix failure when parsing xlsx with drawing having double (redefined) attributes
2019-05-30 11:42:00 +02:00
AlexPravdin ebc0b56959 Fix #853 when loading and saving XLSX file with empty drawing cause c… (#882)
* Fix #853 when loading and saving XLSX file with empty drawing cause corrupted output file. Store empty drawing as unparsed entity and save it as is when saving the file.

* Fix code style
2019-05-30 10:38:03 +02:00
Yigit Cukuren cce6e5976f Calculation :: Added switch function (#983) 2019-05-30 09:14:58 +02:00
Mark Baker 170671c616
CS Fixes (#962) 2019-04-15 22:49:51 +02:00
phinor 98d1782bbb Xls(x) Readers now respect the readBlankCells setting. (#835)
* Prevented reading of blank cells.

The "readEmptyCells" attribute is ignored when reading spreadsheets, resulting in memory bloat.

* Included a test file for Unit Testing

A file that contains 100 referenced cells, one of which contains data.

* New test file for reading in empty cells

* Added test for reading in a blank cell

* Updated CHANGELOG

* Changed "s to 's

Change required for code style compliance

* Further Code Style Changes

Removed spaces after variable, before array indices.

* Further Code Style Changes

* Further Code Style Changes

Removed additional spaces.

* Updated reader and tests.
2019-04-15 21:40:20 +02:00
Michael Roth 15abdf43ad - Create unit test (#944)
- Add changelog entry for issue #700
2019-04-15 21:39:11 +02:00
Mark Baker 9b004b1e6a
Ignore escaped enclosures within an enclosure when inferring csv separator (#906) 2019-02-25 23:20:50 +01:00
Mark Baker 033ed16db5
Dde call safe handling (#891)
* Set handler for quoted text cells and DDE expressions in the Calculation engine
2019-02-18 22:56:32 +01:00
Patrick Brouwers 1c99f4999c [Feature] Html reader improvements (#884)
* Extract character set, so we can convert to UTF-8 if required

* Set column width and row height when defined on tr/td

* Parse align and valign on td

* Specify number format of cell via html attribute

* Formatting of b, strong, i and em tags

* Inserting image in cell when using img tag in html

* Add applying inline styles: border, fonts, alignment, dimensions

* Add tests for applying inline styles
2019-02-16 23:11:16 +01:00
Adrien Crivelli d0dea580ad
Fix a few Scrutinizer issues 2019-01-02 15:38:13 +11:00
Mahmoud Abdo 86c635b3f5
Fix color from CSS when reading from HTML
In case we generate Spreadsheet from html file and the code
in file have text color in css "color:#FF00FF" it will showing
as black color because it will render like rgb content with } "FF00FF}"
So, we fix it by adding missing bracket "{".

Closes #831
2019-01-02 11:57:30 +11:00
Philipp Kolesnikov 8918888e7c
libxml_disable_entity_loader() changes global state so it should be used as local as possible
Fixes #801
Closes #802
Closes #803
2019-01-01 17:25:24 +11:00
Fräntz Miccoli db2621c4fe
Add tests for the LOOKUP function
We were performing operations to patch for missing $result_vector
even when one was defined, this was causing bugs on edge cases.

Fixes #796
Closes #816
2018-12-15 16:23:45 +11:00
Dennis Birkholz e56fbe2745
Fix column names if read filter calls in XLSX reader skip columns
Fixes #777
Closes #778
2018-12-10 20:00:26 +11:00
Krzysztof Ruszczynski 12bf085c57
Custom color for pie and donut charts
This is an follow-up for #158

Fixes #768
2018-12-10 18:43:55 +11:00
Mark Baker a5eb64c77f
Matrix (#790)
* Refactor Excel Matrix functions to use external Matrix library rather than JAMA
2018-11-29 22:25:31 +01:00
MarkBaker 3abb7ccb35 CS Complaining about not uisng $this->assertInternalType('object', $scanner); 2018-11-25 14:41:11 +01:00
MarkBaker 14159d985c Coding standards 2018-11-25 14:33:01 +01:00
MarkBaker 41bcf9a21c Support for additional callback in XML Security Scanner 2018-11-25 14:00:35 +01:00
MarkBaker c708411529 Refactor scanner into base reader class 2018-11-25 12:14:54 +01:00
MarkBaker abad49d426 Use factory for XMLcanner 2018-11-23 23:05:17 +01:00
MarkBaker 5854ce3738 phpcs cleanup 2018-11-20 08:18:35 +01:00
MarkBaker 7a06d71e1c Add UTF-7 XXE Unit test data 2018-11-19 23:22:59 +01:00
MarkBaker a4d97ba896 Clean handle charset in XXE scanner 2018-11-19 22:47:34 +01:00
Adrien Crivelli 2fce5c4706
Update PHP dependencies to fix security issues
This fix CVE-2013-5958 and also
1861e33fe0
2018-11-11 18:21:31 +11:00
Gabriel Caruso b3877e59e4 Use dedicated PHPUnit assertions 2018-11-11 18:06:35 +11:00
Milan Davídek 3be06a5e87
Support overriding `DefaultValueBinder::dataTypeForValue()`
This allow to avoid overriding `DefaultValueBinder::bindValue()`

Fixes #735
2018-11-03 17:25:43 +11:00
Guillaume RODRIGUEZ fdc224af7c
Fix print area parser for XLSX reader
XLSX workbook references may not contains quotes in print area

Fixes #733
Fixes #734
2018-10-28 14:37:05 +11:00
Laurent 79d86ef5cc
Csv reader avoid notice when the file is empty
Fixes #337
2018-10-28 14:16:53 +11:00
Jon Dufresne 5b3870c508
Prefer https:// URLs when available in docs & comments
Fixes #737
2018-10-28 13:55:00 +11:00
marcusblevin 98d10475f2
SUMIFS sum values only once
Values were summed multiple times if it matched several conditions
whereas it should only be summed once.

Fixes #704
Fixes #710
2018-10-28 13:09:08 +11:00
Paul Barton 813855b2b2
Fix CSV delimiter detection on line breaks
The CSV Reader can now correctly ignore line breaks inside
enclosures which allows it to determine the delimiter
correctly.

Fixes #716
Fixes #717
2018-10-21 18:23:55 +11:00
Adrien Crivelli 09eb05f367
OFFSET should allow omitted height and width
Commit 8dddf56 inadvertently removed the ability to omit the width
and height arguments to the OFFSET function. And #REF! is returned
because the function is validating that the new $pCell argument
is present. It is present, but it has been passed in the $height position.

We fixed this by always passing $pCell at the last position and filling
missing arguments with NULL values.

Fixes #561
Fixes #565
2018-10-21 17:45:02 +11:00
Biser Antonov 2c981e47a1
Added the DAYS() function
https://support.office.com/en-us/article/days-function-57740535-d549-4395-8728-0f07bff0b9df
2018-10-21 15:26:46 +11:00
MarkBaker 0ef1b55106 Need to version compare against PHP 7.2.99 for PHP 7.3.0 release candidates 2018-10-14 16:35:38 +01:00
MarkBaker 874467d7c1 DomPDF doesn't yet support PHP 7.3.0, so suppress tests for that combination of version and library dependency 2018-10-14 16:21:40 +01:00
bayzhanov 08b4456641
Xls file threw exception during open by Xls reader
Ignore some exception in property, if stream is empty

Fixes #402
Fixes #659
2018-10-07 18:49:01 +11:00
Scorty ae9dd13aa0 Skip non numeric value in SUMIF
MS Excel skip non numeric values also. PhpSpreadsheet used to fail on string value with: Warning: A non-numeric value encountered.

Fixes  #618
2018-10-07 17:24:23 +11:00
Timur 50a9bc83ab Sheet title can contain exclamation mark (in formulas)
When extracting sheet title from string reference (like `"Work!sheet1!A1"`), PHP function `explode()` divide this string into three parts: `['Work', 'sheet1', 'A1']`. And then these wrong values are used in formulas, ranges, etc.

This change fix that problem by using special function `Worksheet::extractSheetTitle()`. This function also has been changed to make sure that worksheet title can contain "!" character. So, that function search last position of "!" in reference string and divide it to 2 parts correctly: `['Work!sheet1', 'A1']`.

Fixes #325
Fixes #662
2018-10-03 12:52:51 +09:00
Dalibor Karlović 5e090d1af0
Allow iterators to go out of bounds with prev()
Iterators prev() behavior is now consistent with next(), meaning
that it can go out of bounds and it must be validated with valid()
before using it.

Fixes #587
Fixes #627
2018-08-19 14:02:17 +09:00
Julian Kern c04b92198e
Column dimensions are read by Reader\Xlsx
Fixes #596
Fixes #616
2018-08-06 10:33:27 +09:00
Adrien Crivelli 98c55b0f88
Migrator only replaced "PHPExcel" 2018-08-05 23:03:04 +09:00
Walter Nasich 048947e390
Avoid memory exhaustion when cloning worksheet with a drawing
When cloning `BaseDrawing`, its worksheet will be set as null and thus be
orphaned. But when cloning the worksheet, it will re-assign itself as the
new worksheet for the BaseDrawing.

That way we avoid recursive cloning of a Worksheet that would clone a
BaseDrawing that would clone a Worksheet etc.

Fixes #437
Fixes #613
2018-08-05 13:21:01 +09:00
Mark Baker 1b96c95a44
Add new Complex Number Functions introduced in MS Excel 2013 (#601)
* - Refactored Complex Engineering Functions to use external complex number library
- Added calculation engine support for the new complex number functions that were added in MS Excel 2013
    - IMCOSH()  Returns the hyperbolic cosine of a complex number
    - IMCOT()   Returns the cotangent of a complex number
    - IMCSC()   Returns the cosecant of a complex number
    - IMCSCH()  Returns the hyperbolic cosecant of a complex number
    - IMSEC()   Returns the secant of a complex number
    - IMSECH()  Returns the hyperbolic secant of a complex number
    - IMSINH()  Returns the hyperbolic sine of a complex number
    - IMTAN()   Returns the tangent of a complex number
* Simplified the parseComplex() method in the PhpOffice\PhpSpreadsheet\Calculation\Engineering class, using Complex\Complex; and docblock flagged as deprecated
2018-07-25 14:38:44 +01:00
Mark Baker 67cdee6033
Add new Bitwise Functions introduced in MS Excel 2013 (#603)
* - Added calculation engine support for the new bitwise functions that were added in MS Excel 2013
  - BITAND()     Returns a Bitwise 'And' of two numbers
  - BITOR()      Returns a Bitwise 'Or' of two number
  - BITXOR()     Returns a Bitwise 'Exclusive Or' of two numbers
  - BITLSHIFT()  Returns a number shifted left by a specified number of bits
  - BITRSHIFT()  Returns a number shifted right by a specified number of bits
2018-07-22 22:16:34 +01:00
Mark Baker 9b44cf3418
Add further new Functions introduced in MS Excel 2013 and 2016 (#608)
- Fix ISFORMULA() function to work with a cell reference to another worksheet
 - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016
   - Text Functions
     - CONCAT()     Synonym for CONCATENATE()
     - NUMBERVALUE()  Converts text to a number, in a locale-independent way
     - UNICHAR()    Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally
     - UNIORD()     Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally
     - TEXTJOIN()   Joins together two or more text strings, separated by a delimiter
   - Logical Functions
     - XOR()        Returns a logical Exclusive Or of all arguments
   - Date/Time Functions
     - ISOWEEKNUM()  Returns the ISO 8601 week number of the year for a given date
   - Lookup and Reference Functions
     - FORMULATEXT()  Returns a formula as a string
   - Engineering Functions
     - ERF.PRECISE()   Returns the error function integrated between 0 and a supplied limit
     - ERFC.PRECISE()  Synonym for ERFC
   - Math and Trig Functions
     - SEC()          Returns the secant of an angle
     - SECH()         Returns the hyperbolic secant of an angle
     - CSC()          Returns the cosecant of an angle
     - CSCH()         Returns the hyperbolic cosecant of an angle
     - COT()          Returns the cotangent of an angle
     - COTH()         Returns the hyperbolic cotangent of an angle
     - ACOT()         Returns the cotangent of an angle
     - ACOTH()        Returns the hyperbolic cotangent of an angle
  - Financial Functions
    - PDURATION()    Calculates the number of periods required for an investment to reach a specified value
    - RRI()          Calculates the interest rate required for an investment to grow to a specified future value
2018-07-22 19:17:04 +01:00
Adrien Crivelli 3028c60656
Remove unnecessary docs 2018-07-15 13:23:46 +09:00
Adrien Crivelli 863fb86925
Remove file header 2018-07-15 13:23:23 +09:00
yuzhakov 17d4a54666
Read and write hyperlink for drawing image
Fixes #490
2018-07-15 13:00:30 +09:00
Einar Lielmanis b05d07a365 Chained operations on cell ranges involving borders are now possible
Fixes #428
Fixes #578
2018-07-15 12:19:54 +09:00
Rolands Usāns eb31899225 Function EXACT(arg1, arg2) support (#595) 2018-07-15 11:56:25 +09:00
Adrien Crivelli 9fdcaabe3c
Could not open CSV file containing HTML fragment
We now always trust the file extension to avoid false positive of mime
detection for most simple cases. But we still try to guess the mime type
if the file extension does not match or is missing.

Fixes #564
2018-06-25 11:12:27 +09:00
Bill Blume edb68ce05c
Support workbook view attributes for Xlsx format
Editing a Xlsx document using PhpSpreadsheet should preserve the workbook
view attributes of that document. For example, if the worksheet tabs are
hidden in the original document, they should remain hidden after updating.

Fixes #523
Fixes #525
2018-06-24 20:15:38 +09:00
Bill Blume 4c09d4f668
Properly set selected cells for frozen panes
Properly set the selected cells for worksheets with frozen panes when
writing Xlsx documents. Beforehand, the saved Xlsx documents were
generating corruption warnings when opened in Excel.

Fixes #532
Closes #535
2018-06-10 14:56:53 +09:00
Bill Blume e3fb160f5f
Fixed parsing of conditionals in COUNTIF functions
Conditional operators in the selection parameter of COUNTIF
functions were not being parsed properly, causing evaluations
of formulae with such functions to sometimes fail.

Fixes #526
Closes #528
2018-06-10 14:25:33 +09:00
Robin D'Arcy ed2185417e
Throw exception for invalid range to prevent infinite loop
Fixes #519
Closes #521
2018-06-10 13:34:10 +09:00
Dominik b509b672e0
Xlsx reader do not read rows and columns filtered out in readFilter at all
Set rows and columns dimensions for only cells rows and columns
allowed by readfilter

Fixes #370
Closes #421
2018-05-26 13:30:21 +09:00
Dominik 7e9f43bf5b
Fix Xlsx loaded an extra empty comment for each real comment
Fixes #375
Closes #420
2018-05-26 11:19:12 +09:00
Robin D'Arcy c723833d6f Allow CSV escape character to be set
Fixes #492
Closes #510
2018-05-23 10:31:41 +09:00
Adrien Crivelli 148909300c
`Helper\Html` support UTF-8 HTML input
Assume UTF-8 encoding. Not assuming UTF-8 would mangle text such as "русский"

Fixes #444
2018-05-20 19:52:53 +09:00
Adrien Crivelli eda1c8a4d6
Fix spacing according to Scrutinizer 2018-05-12 22:02:46 +09:00
Maxim Bulygin 83c759e951
Support to read and write unsupported data for XLSX
This will let users read a file that contains data that are not properly
supported and write them back to a new file untouched.

- load workbookProtection attributes
- save loaded pageSetup[r:id]
- save loaded sheet's AlternateContent
- save loaded unparsed VmlDrawings
- save loaded drawing files `rId`
- save loaded draw's AlternateContent
- save loaded control properties
- save loaded printer settings
- save loaded unparsed override content types (for ctrlProp, ...)

Closes #435
2018-05-12 11:47:46 +09:00
Adrien Crivelli 064076ac6d
Fix unit tests for PHP 5.6 2018-05-07 11:53:55 +09:00
MarkBaker bbe11eed37 Full unit tests for SUBTOTAL function 2018-05-06 23:43:02 +01:00
MarkBaker 3298667153 Mark SUBTOTAL test as skipped for the moment 2018-04-21 21:28:41 +01:00
MarkBaker f08eeaa2ed Code works, but the tests don't yet 2018-04-21 20:34:25 +01:00
MarkBaker 36afa01d33 SUBTOTAL within a SUBTOAL range should be ignored 2018-04-21 01:33:26 +01:00
MarkBaker 04b4e74ec7 Basic unit testing for 100 series actions for SUBTOTAL() with hidden rows/columns 2018-04-20 07:24:11 +01:00
MarkBaker 1ece540254 Basic unit test for SUBTOTAL() function 2018-04-19 22:44:23 +01:00
Tony Brix bdc95b14bf
Select correct cell when calling freezePane
Fixes a bug when calling `$sheet->freezePane('B2')` without a second argument.
The selected cell will now be `B2` instead of the incorrect `B3`.

Fixes #389
Closes #393
2018-03-03 16:48:30 +01:00
Josh Grant a089a87671
Avoid losing calculated value type
Closes #394
2018-03-03 11:51:06 +01:00
Josh Grant 148bee1991
Support `_xlfn.` prefix and add `ISFORMULA`, `MODE.SNGL`, `STDEV.S`, `STDEV.P`
This change adds support for newer functions that are prefixed
by _xlfn. (#356). The calculation engine has been updated to
recognise these as functions, and drop the _xlfn. part.

It also add a couple of the new functions such as STDEV.S/P,
MODE.SNGL, ISFORMULA.

Fixes #356
Closes #390
2018-02-26 09:35:53 +01:00
Adrien Crivelli 1adc3a6688
Read printing area correctly when skipping some sheets
Fixes #371
2018-02-25 19:40:11 +01:00
Adrien Crivelli e31878ceb1
Check for MIME type to know if CSV reader can read a file
CSV reader used to accept any file without any kind of check. That made
users incorrectly believe that things were ok, even though there is no
way for CSV reader to read anything else that plain text files.

Fixes #167
2018-02-05 21:33:23 +09:00
Adrien Crivelli d2f55ffa07
Support PHP 7.2 2018-01-28 16:23:38 +09:00
Adrien Crivelli c96e2dae02
Update to PHP-CS-Fixer 2.10 2018-01-28 15:59:38 +09:00
MaxTingle 49775bd972
Fix cell ranges causing coordinate merge error
Fixes #319
Closes #328
2018-01-22 12:26:37 +09:00
Michael Bollman 4e0344c3af
Use line width for data series when rendering Xlsx
Closes #329
2018-01-22 11:50:53 +09:00
Adrien Crivelli 481fc4a7c6
Support XML file without styles
Closes #331
Closes https://github.com/PHPOffice/PHPExcel/pull/559
Fixes https://github.com/PHPOffice/PHPExcel/issues/558
2018-01-14 17:08:50 +09:00
Adrien Crivelli bf2dbbaf10
COLUMNS and ROWS functions crashed in some cases
Fixes #336
Fixes https://github.com/PHPOffice/PHPExcel/issues/1383
2018-01-13 18:01:50 +09:00
Adrien Crivelli 25bc54f9eb
Freeze Panes takes wrong coordinates for XLSX
Fixes #322
2018-01-09 00:42:30 +09:00
Steffen Breiler 653adf8e10
Adding option to stop at a conditional styling, if it matches
This would be used like `$conditonal->setStopIfTrue()` and is only supported
for XLSX format for now.

Closes #292
2018-01-07 22:45:51 +09:00
Christoph "criztovyl" Schulz cdbf3347cb
Support for cell comments in HTML writer and reader
The behavior is similar to what is done in LibreOffice. That means if there is a
comment it will be shown with a small indicator and the actual comment will be
revealed when mouse hover over the indicator.

Fixes #308
Closes #310
2018-01-07 21:51:48 +09:00
Adrien Crivelli 4f1fae5298
Test classes must ends with `Test` 2018-01-02 00:53:28 +09:00
Adrien Crivelli 4dd486fb94
Clean up very obsolete links 2017-12-30 19:07:22 +09:00
Adrien Crivelli 139d85d874
Better auto-detection of CSV separators
Closes #305
2017-12-28 12:25:37 +09:00
Adrien Crivelli fb5f8d4763
Support DateTimeImmutable as cell value 2017-12-23 21:50:07 +09:00
Adrien Crivelli 32a55a3f13
Introduce identical functional tests across several formats 2017-12-17 16:35:20 +09:00
Adrien Cohen 11b055b29f
Able to set the `topLeftCell` in freeze panes
Fixes #260
Closes #261
2017-12-17 13:32:16 +09:00
Adrien Crivelli eb58563b4b
Written DataValidation was corrupted
Fixes #290
2017-12-16 17:15:13 +09:00
Adrien Crivelli 08e860b993
Uncomment test cases 2017-12-11 12:22:49 +09:00
Adrien Crivelli 96f3f666d6
Support to write merged cells in ODS format
Fixes #287
2017-12-11 12:17:40 +09:00
Adrien Crivelli 962367c95f
Can read very small HTML files
Fixes #194
2017-12-11 11:09:25 +09:00
Gabriel Caruso dfcab0c13f Use assertInstanceOf (#286) 2017-12-06 18:46:31 +09:00
Adrien Crivelli 8d76020590
Consistent `stringFromColumnIndex()` and `columnIndexFromString()`
Column indexes are always based on 1 everywhere in PhpSpreadsheet.
This is consistent with rows starting at 1, as well as Excel
function `COLUMN()`. It should also make it easier to reason about
columns and rows and remove any doubts whether a specific method is
expecting 0 based or 1 based indexes.

Fixes #273
Fixes https://github.com/PHPOffice/PHPExcel/issues/307
Fixes https://github.com/PHPOffice/PHPExcel/issues/476
2017-11-26 15:29:08 +09:00
Adrien Crivelli e0150fd43e
Extract coordinate methods to `Coordinate` class 2017-11-18 23:52:38 +09:00
Gabriel Caruso aed27a0bed Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase (#271)
Use the `PHPUnit\Framework\TestCase` notation instead of `PHPUnit_Framework_TestCase` while extending our TestCases. This will help us migrate to PHPUnit 6, that [no longer support snake case class names](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-6.0.md#changed-1).
2017-11-09 00:48:01 +09:00
Adrien Crivelli 40efcd2fdd
Rename tests according to the class the class they are testing 2017-11-03 12:47:19 +09:00
Maxim Bulygin 6561494e32
Add possibility to check validity of a cell value, based on data validation rules
`$cell->hasValidValue()` returns true if the cell has a value which conform to the
rules defined in `$cell->getDataValidation()`.

Closes #257
2017-10-31 14:07:24 +09:00
Adrien Crivelli 557e80dc03
Rename classes to keep them in their related namespaces 2017-10-29 17:39:42 +09:00
Adrien Crivelli 3982ce2944
Remove unused variables and parameters 2017-10-29 14:09:38 +09:00
Adrien Crivelli 782b4e4fae
Upgrade chart rendering support to be composer based
This allow to get rid of manual class loading and have simpler
usage of the library.
2017-10-29 01:58:42 +09:00
Adrien Crivelli 25ff914aa6
Simplify IOFactory to rely on autoloading 2017-10-22 01:54:14 +09:00
mosa ee700f7c7d change array_push() to $array[] (#254)
http://php.net/manual/en/function.array-push.php#refsect1-function.array-push-description

> Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.
2017-10-19 11:07:31 +09:00
Adrien Crivelli bd3285b4fa
Avoid underscore in property names 2017-10-08 14:37:11 +09:00
Adrien Crivelli 483f3c98ff
More fixes from PhpStorm warnings 2017-10-08 02:00:30 +09:00
Maxim 088a76737e Fix DAY() function with 0<x<1 input (#230)
Also bring support for OpenOffice DATE() calculation method
2017-10-04 12:57:01 +09:00
Adrien Crivelli 440bfe637f
Don't use short list syntax to keep PHP 5.6 compatibility 2017-10-01 21:50:40 +09:00
Adrien Crivelli 4fd8e742e7
Upgrade to PHP-CS-Fixer 2.7 2017-10-01 20:07:04 +09:00
Adrien Crivelli e95e4dfd13
Re-enable tests on samples 2017-10-01 18:18:45 +09:00
Adrien Crivelli 50a0ec58af
Merge all examples together
Closes #17
2017-10-01 17:48:59 +09:00
Adrien Crivelli 68bb90bb6e
Remove PHPUnit group fail19, because it has no use anymore 2017-09-30 12:18:14 +09:00
Maxim 810f174d6e Fix INDEX() function when rows count less than row number (#233) 2017-09-30 12:13:20 +09:00
GreatHumorist 2abe56b946 Support missing attribute `r` in `c` node when reading xlsx
When describing a cell, the cell reference (r="A1") is optional.
When not present, we should just increment the index of the last processed row.

Fixes #201 
Closes #225
2017-09-22 14:49:38 +09:00
GreatHumorist 7aa6233185
Added xml reader hyperlink support
Closes #223
2017-09-22 14:40:47 +09:00
Adrien Crivelli aef4d711f5
Use `self::assert*()` instead of `$this->assert*()`
Because even if it doesn't make a difference in practice, it is
technically more correct to call static methods statically. It
also better advertise that those methods can be used from any context.
2017-09-22 14:22:44 +09:00
GreatHumorist 0477e6fcfe In Xml reader throw exception in case of invalid XML (#222)
When the xml file is not a standard xml file, the `simplexml_load_string` will return false, this will cause an error on "$xml->getNamespaces(true);" . So instead of showing the error, we throw an exception.
2017-09-20 14:20:12 +09:00
all-lala 81c1b14048
Re-use original palette color when possible
This is to prevent color changing when copy/pasting xls files written by
PhpSpreadsheet to another file.

Closes #218
2017-09-11 14:28:49 +09:00
Adrien Crivelli 1cf119dd0b
Escape control characters in cell values
Control characters in cell values are automatically escaped without
the need to excplicitly call `StringHelper::buildCharacterSets()` beforehand.

Fixes #212
2017-09-09 19:29:08 +09:00
Adrien Crivelli 1c5db4e170
Standardize keys used for styling
Array keys used for styling have been standardized for a more coherent experience.
It now uses the same wording and casing as the getter and setter methods.

Closes #189
2017-09-09 02:56:23 +09:00
Bill Blume 2761773b3d
Merge data-validation collections to reduce the final file size
Closes #131
Closes #193
2017-09-08 02:27:18 +09:00
Adrien Crivelli 31daed0048
Fix class name case 2017-08-02 23:13:08 +02:00
Mikkel Paulson 1853aaac79 Add option to suppress validation of sheet titles (#186)
Add option to suppress validation of sheet titles

Based on a "lowest common denominator" approach to compatibility,
we will continue to enforce a 31-character limit for sheet titles.
However, this limit should not be enforced when loading an existing
file.

Added a new optional parameter to Worksheet::setTitle() and
Worksheet::setCodeName() to suppress validation and massaging,
based on the premise that existing files should be given a
best-effort approach to loading and parsing. Unfortunately, it's
not possible with the current architecture to prevent users from
making use of this functionality, aside from with a strongly-worded
warning.

Added test coverage. I didn't see any existing unit tests of the
Worksheet class, so I created a new test to cover these methods.

Fixes #176
2017-07-14 10:53:13 +02:00
Zharikov Viktor 07455d24f6
Make global usage of `use` instead of FQCN
Closes #78
Closes #147
2017-05-18 00:10:16 +02:00
Markus Lanthaler 3ee9cc5ce6
Infer CSV delimiter if it hasn't been set explicitly
Closes #141
2017-04-20 17:02:03 +09:00
Adrien Crivelli 75d3bdb016
Declare arguments as required when they are
Closes #110
2017-04-16 14:25:28 +09:00
Adrien Crivelli 06ca8f9b04
Leverage type hinting to assert array parameters 2017-04-16 14:25:28 +09:00
Adrien Crivelli 033a4bdad5
Remove default values for function that should not have any default
Having default values made it harder for end-user to figure out whether
it the arguement had to be supplied or not. Ommitting the argument may
lead to hard to debug issues, and is overall not a good idea.

Closes #110
2017-04-16 14:25:28 +09:00
Adrien Crivelli 45e8529a7e
Remove mention of bug in SQLite3
Since the refactoring towards PSR-16 it is very unlikely that the bug
still exists.
2017-04-14 17:27:54 +09:00
Adrien Crivelli fd9c925a7b
Refactor CachedObjectStorage to PSR-16
This drop a lot of non-core features code and delegate their maintainance
to third parties. Also it open the door to any missing implementation
out of the box, such as Redis for the moment.

Finally this consistently enforce a constraint where there can be one and
only one active cell at any point in time in code. This used to be true for
non-default implementation of cache, but it was not true for default
implementation where all cells were kept in-memory and thus were never
detached from their worksheet and thus were all kept functionnal at any
point in time.

This inconsistency of behavior between in-memory and off-memory could
lead to bugs when changing cache system if the end-user code was badly
written. Now end-user will never be able to write buggy code in the first
place, avoiding future headache when introducing caching.

Closes #3
2017-04-14 16:56:27 +09:00
Kurounin b01671213a
Removed double un-escaping when reading CSV
Removed "unescape enclosure functionality", since the unescaping is already handled by fgetcsv,
and performing the unescaping again would actually result int the text from the cell being read wrong.

As an example try parsing the folowing CSV:

```
"<img alt="""" src=""http://example.com/image.jpg"" />"
```

With the additional unescaping it would have ended up as:

```
<img alt=" src="http://example.com/image.jpg" />
```

instead of the correct:
```
<img alt="" src="http://example.com/image.jpg" />
```

Fixes https://github.com/PHPOffice/PHPExcel/pull/1171
2017-04-03 11:57:10 +09:00
Adrien Crivelli b7b10612ab
Re-enable unit tests that should work again now 2017-04-01 14:17:53 +09:00
Paolo Agostinetto fd83c191ea MATCH function behavior when third parameter is equal to 1 or -1
Fixes #51 
Closes #122
2017-04-01 12:36:02 +09:00
Paolo Agostinetto 9767112b23 Settings: deleted libxml_disable_entity_loader() calls (#113)
Settings: deleted libxml_disable_entity_loader() calls since they're not necessary.
Prevent setLibXmlLoaderOptions() and getLibXmlLoaderOptions() to call the libxml_disable_entity_loader() function which alter the global state of libxml.
See the discussion here https://github.com/PHPOffice/PhpSpreadsheet/issues/74
2017-03-12 22:00:46 +09:00
Adrien Crivelli ea5663bc00
Drop support for PclZip
Over the years PclZip became a maintenance problem. It's code base
is old and the official project seems to have died out. ZipArchive
is now more commonly available and offer an easier and more complete
API. So PclZip was dropped in order to focus our efforts on what matters.

Closes #18
2017-03-11 11:48:46 +09:00
Adrien Crivelli 93e2204774
Document ODS supported features
This should be completed in the future.
2017-03-06 14:40:27 +09:00
Paolo Agostinetto 219e4e6258 Writer\Ods\Content: Set "CompatibilityMode" before and after running the tests in
order to avoid conflicts with other tests
2017-03-04 17:18:18 +01:00
Paolo Agostinetto 93b5337bda Writer\Ods\Content: Fix CS 2017-03-04 17:18:18 +01:00
Paolo Agostinetto 4efda2a512 Ods\Writer\Content: added support for xr styles (bold, italic, font family, font size, underline, bg color) 2017-03-04 17:18:18 +01:00
Paolo Agostinetto 5620510991 Writer\Ods\Content: basic unit tests 2017-03-04 17:18:18 +01:00
Paolo Agostinetto f3c62b615e Merge remote-tracking branch 'upstream/develop' into fix-85 2017-02-20 21:13:03 +01:00
Paolo Agostinetto 9785f926c1 php-cs run: fixed code style for new/changed files 2017-02-20 21:05:25 +01:00
Paolo Agostinetto a0321fd6fd Removed PhpStorm comment on top of file 2017-02-20 21:02:49 +01:00
Paolo Agostinetto c954eddf57 Ods reader: fix sheet count and added a test for sheet names 2017-02-20 21:02:04 +01:00
Paolo Agostinetto 6d6353c0f1 Ods reader: fix reading of cells with hyperlinks 2017-02-18 20:59:14 +01:00
Paolo Agostinetto 1dba2d1766 Ods reader: tests for repeated spaces and rich text 2017-02-18 20:49:48 +01:00
Paolo Agostinetto bcd1bc364c Ods reader: test loading of Worksheets 2017-02-18 13:55:22 +01:00
Paolo Agostinetto 3c7b2e23da Added unit tests for Ods reader 2017-02-18 13:36:08 +01:00
Adrien Crivelli 7b90bb9394
Drop checks for mbstring existence
Since mbstring is now a hard dependency enforced by composer, it is
no longer necessary to check for its presence and implement fallbacks.
2017-02-16 11:56:22 +09:00
Adrien Crivelli 6e247c30d9
Drop support for SQLite 2 because it does not exist in PHP 5.6+ anymore 2017-02-14 12:53:20 +09:00
Adrien Crivelli 9e835676a6
Update dev dependencies 2017-01-23 16:02:59 +09:00
Adrien Crivelli fe73b2d402
Drop PHPSPREADSHEET_ROOT constant 2017-01-23 15:35:10 +09:00
Adrien Crivelli 909353ea39
Simplify bootstrap for tests 2017-01-23 15:05:41 +09:00
Adrien Crivelli 8dddf56c2e
Use proper syntax for variadic functions
This simplify code, increase readability and improve the function
signature for API users.
2017-01-23 15:01:20 +09:00
Adrien Crivelli 031af1e9d2
Standardize writers and readers name to be the format most common extension in CamelCase 2017-01-22 17:39:23 +09:00
Henrik Gemal 5a8acce94c minor fixes to unit tests (#72) 2017-01-13 12:06:00 +09:00
Adrien Crivelli ec928d393f
Fix indentation as suggested by Scrunitizer 2017-01-05 12:26:20 +09:00
Adrien Crivelli 56245d558e
Use `::class` notation as much as possible
```
               *             ,
                           _/^\_
                          <     >
         *                 /.-.\         *
                  *        `/&\`                   *
                          ,@.*;@,
                         /_o.I %_\    *
            *           (`'--:o(_@;
                       /`;--.,__ `')             *
                      ;@`o % O,*`'`&\
                *    (`'--)_@ ;o %'()\      *
                     /`;--._`''--._O'@;
                    /&*,()~o`;-.,_ `""`)
         *          /`,@ ;+& () o*`;-';\
                   (`""--.,_0 +% @' &()\
                   /-.,_    ``''--....-'`)  *
              *    /@%;o`:;'--,.__   __.'\
                  ;*,&(); @ % &^;~`"`o;@();         *
                  /(); o^~; & ().o@*&`;&%O\
            jgs   `"="==""==,,,.,="=="==="`
               __.----.(\-''#####---...___...-----._
             '`         \)_`"""""`
                     .--' ')
                   o(  )_-\
                     `"""` `
```
2016-12-26 13:21:12 +09:00
Adrien Crivelli 8c66afe39a
Upgrade to PHP-CS-Fixer 2.0 2016-12-22 23:46:26 +09:00
Adrien Crivelli 5d3fdf4f78
Skip test on Travis because of recent PHP upgrade 2016-12-14 22:40:21 +09:00
Adrien Crivelli c8a8fd2610
Stricter check whether file exists before reading
This should avoid issues when user submit a non-existing filename
that is wrongly identified as CSV.

Typically https://github.com/PHPOffice/PHPExcel/issues/1076 and
https://github.com/PHPOffice/PHPExcel/issues/1078 could have been
avoided.
2016-12-09 00:15:22 +09:00
Adrien Crivelli 3bd0f6f985
Fix autofilter cloning across PHP versions
Avoid indirect access variable ambiguity across PHP 5.6 and PHP 7.0
2016-12-04 16:44:40 +09:00
Adrien Crivelli e6d8362fb2
Some functions were not callable because of wrong declaration 2016-12-03 14:51:04 +09:00
Adrien Crivelli 5ad6ced95c
Introduce a tool to migrate from PHPExcel to PhpSpreadsheet 2016-11-28 00:13:57 +09:00
Alexander Kurilo 408da0c17a Make HTML checks more strict 2016-11-16 22:21:30 +09:00
Alexander Kurilo 928b592c14 Add readable labels for data provider samples 2016-11-16 22:21:30 +09:00
Alexander Kurilo 2809cce298 Remove unused data from test provider data set 2016-11-16 22:21:30 +09:00
Alexander Kurilo edb3974a0d Move XEEE test data to add data for other readers 2016-11-16 22:21:30 +09:00
Adrien Crivelli e2e982f98a
Rename OOCalc and OpenDocument into Ods
FIX #6
2016-10-06 21:07:57 +09:00
Adrien Crivelli 39b55ded30
Rename Excel2007 into Xlsx
FIX #5
2016-10-06 20:39:10 +09:00
Adrien Crivelli 431a1799fb
Fix unit tests for YEARFRAC() 2016-10-02 15:17:52 +09:00
Adrien Crivelli 8c4c11346b
Fix unit tests for DATEDIF()
Leap years where not properly taken into consideration
2016-10-02 14:46:11 +09:00
Adrien Crivelli 8061f7516e
Rename SECONDOFMINUTE into SECOND for consistency 2016-10-02 09:43:13 +09:00
Adrien Crivelli b5af5a772e
Fix unit tests for SECOND() 2016-10-02 09:42:14 +09:00
Adrien Crivelli 75c34f2694
Rename MINUTEOFHOUR into MINUTE for consistency 2016-10-02 09:41:20 +09:00
Adrien Crivelli 7de0439b96
Fix unit tests for MINUTE() 2016-10-02 09:40:07 +09:00
Adrien Crivelli c15ab515a7
Fix unit tests for testTIMEVALUEtoPHP 2016-10-02 09:37:52 +09:00
Adrien Crivelli 382d15a5c3
Rename DAYOFWEEK into WEEKDAY for consistency 2016-10-02 09:35:50 +09:00
Adrien Crivelli 4c41a6992a
Fix unit tests for testTIMEtoPHP 2016-10-02 09:31:14 +09:00
Adrien Crivelli 60533a4f59
Fix unit tests for WEEKDAY()
In Excel the expected value was incorrect (but it would be different
for LibreOffice)
2016-10-02 09:28:00 +09:00
Adrien Crivelli 9629151e45
Rename WEEKOFYEAR into WEEKNUM for consistency 2016-10-01 22:44:33 +09:00
Adrien Crivelli 23fbc845dd
Fix unit tests for WEEKNUM() 2016-10-01 22:33:12 +09:00
Adrien Crivelli 93ccf78dd5
Exclude more tests 2016-09-09 11:58:12 +09:00
Adrien Crivelli 2c96a06d6e
Exclude long tests on Travis
Tests that run too long without output tends to break Travis builds.
This is typically the case when running code-coverage, so we need to
exclude a few test cases to ensure that the builds are stable.
2016-09-09 01:27:09 +09:00
Adrien Crivelli 150ad19580
Ask Travis to wait longer for PHPUnit to finish 2016-09-01 11:20:22 +09:00
Adrien Crivelli cfa1feffed
Attempt to show samples output so Travis don't interrupt tests 2016-09-01 02:22:19 +09:00
Adrien Crivelli 47cde0dadc
Introduce vendor prefix `PhpOffice` to namespace 2016-09-01 02:20:47 +09:00
Adrien Crivelli 2922a13764
Reorganize code samples
This introduce a helper class that should be used to log things,
avoiding a lot of boilerplate code.

Also all output are made in /tmp folder instead of beside the script
itself. This is because there is a high chance that the folder containing
the script is not writtable by webserver. So using the /tmp folder
makes it more likely to works in a variety of setup.
2016-09-01 01:17:13 +09:00
Adrien Crivelli f917b3b1f4
Avoid `call_user_func()` whenever possible 2016-08-26 15:39:29 +09:00
Adrien Crivelli 04d6182a81
Remove unused variables 2016-08-26 15:05:40 +09:00
Adrien Crivelli 20ccfa0d59
Fix unit tests for MDETERM() 2016-08-25 14:23:26 +09:00
Adrien Crivelli 29bdbd4e0b
Respect PSR-0 with matching folder name and namespace `PhpSpreadsheetTests` 2016-08-25 13:53:15 +09:00