Commit Graph

637 Commits

Author SHA1 Message Date
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
Benjamin Yau
d2bbb6cd8e Fix wrong calculation of highest column (#856)
* Fix wrong calculation of highest column

issue #700

* Revert "Fix wrong calculation of highest column"

This reverts commit ef39af1cb6bac8f3101aa52a6336d736910d387b.

* Revert "Revert "Fix wrong calculation of highest column""

This reverts commit d13493ecbedf57253448438311c1d04a3ebdb65e.

* Revert Xlsx reader

* Fix indentation
2019-02-17 18:32:45 +01:00
MarkBaker
a8642a2e9e More CS niceties 2019-02-17 17:50:39 +01:00
MarkBaker
917592001e CS Style fixes 2019-02-17 17:40:57 +01:00
Mark Baker
f4f4d513e7
Handling function calls that accept an excel error as an argument (#890) 2019-02-17 17:32:45 +01:00
naooooooo99999
a54ed63a6f Add japanese formats (#841) 2019-02-17 12:39:51 +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
Mark Baker
11575ef3c4
Load locales clean folder path (#875)
* Fix locale folder path when reading locale list

* Ensure / directory separaor isn't left against locale name
2019-02-08 21:08:55 +01:00
Adrien Crivelli
d0dea580ad
Fix a few Scrutinizer issues 2019-01-02 15:38:13 +11:00
Adrien Crivelli
04b5bf593d
Document font may be null
Fixes #833
2019-01-02 14:34:14 +11:00
Adrien Crivelli
3b0c686630
Fix iconv unsupported //IGNORE//TRANSLIT on IBM i
Fixes #791
2019-01-02 14:23:34 +11:00
GreatHumorist
699da09176
Fix time format for duration was incorrect
When using format `[h]:mm` it should convert to the "total hours:minutes"

Closes #666
Fixes #664
Fixes #446
Fixes #342
2019-01-02 13:17:52 +11:00
Kirill Petrov
39b573b29d
Fix infinite loop when reading invalid ODS files
According to the spec, http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415588_253892949,
a `<table:table-row>` can only ever contains a `<table:table-cell>` or
a `<table:covered-table-cell>`, but it seems that some invalid files in the wild
may contains something else. That would trigger an infinite loop. So instead we
totally ignore the invalid content.

Closes #832
2019-01-02 12:16:41 +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
Matt Allan
0f8292fc0b
Use gt operator instead of max for highest row
Using an operator is significantly faster than calling the max function.
As this method is called more than once per cell the difference adds up.

Closes #824
2019-01-02 11:09:55 +11:00
Matt Allan
ff6f4f4ec0
Remove duplicate strtoupper
Removing the duplicate strtoupper call has a meaningful impact on
performance since this method is called at least once per cell.

`Worksheet::getCells` currently calls `strtoupper` twice. `strtoupper`
is kind of expensive and this method is called at least once for every
cell in the spreadsheet.  By removing the unnecessary second call the
runtime decreases by 18% when importing a ~100K cell spreadsheet.

Closes #825
2019-01-01 17:54:55 +11:00
Matt Allan
f28289f92a
Use a generator for Cells::getAllCacheKeys
Using a generator reduces memory usage and improves performance
when loading large spreadsheets.

Closes #822
2019-01-01 17:38:07 +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
Paolo
6a48b505b6
Support COUNTIFS multiple arguments
Because Excel COUNTIFS function can have more than 2 arguments.

Closes #830
2019-01-01 16:38:45 +11:00
Fräntz Miccoli
294ba58dde
Exact match in VLOOKUP now returns first match
It was inconsistent with spreadsheet software before.

Closes #809
2018-12-15 17:42:07 +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
Christian Stoller
f0e69408ca Extended the docblock of Style::applyFromArray with example for alignment styling 2018-12-10 20:24:29 +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
Gabriel Caruso
dfa808a955 Simplify some conditions and ternary expressions 2018-12-10 18:54:51 +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
Dennis Birkholz
95c41da020 Cache readFilter access and skip inner loops for empty/default readFilter (#773)
For large XLSX files `Reader/Xlsx::readColumnsAndRowsAttributes()` performs
a lot of calls to `$this->getReadFilter()` and `$this->getReadFilter()->readCell()`
as `readCell()` is called twice for each (possibbly filled) cell.

By ignoring calls to the DefaultReadFilter implementation (which always returns true),
using no custom read filter will not incur any runtime penalty.

The runtime penaltiy when using a custom read filter is reduced by a third by
caching the read filter into a variable instead of using the getter method.

Fixes issue #772.
2018-11-29 22:50:48 +01: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
14159d985c Coding standards 2018-11-25 14:33:01 +01:00
MarkBaker
c1d0784ad7 Namespace security scanner in Html Reader 2018-11-25 14:18:09 +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
aba41f6495 Yet more Coding standards fixes 2018-11-23 23:27:19 +01:00
MarkBaker
6d3d44359d Coding standards 2018-11-23 23:18:49 +01:00
MarkBaker
abad49d426 Use factory for XMLcanner 2018-11-23 23:05:17 +01:00
MarkBaker
9c1a201ace Fix docblock typo 2018-11-20 19:51:09 +01:00
MarkBaker
f02898e14d Don't rely purely on libxml_disable_entity_loader() 2018-11-20 18:40:09 +01:00
MarkBaker
1f4cb1f19a Corrections to XmlScanner version check logic, and (hopefully) fix the lock issue 2018-11-20 18:24:53 +01:00
Adrien Crivelli
e4be53888f
Update src/PhpSpreadsheet/Reader/Security/XmlScanner.php
Co-Authored-By: MarkBaker <mark@lange.demon.co.uk>
2018-11-20 11:46:09 +01:00
Adrien Crivelli
7f4a6e37b1
Update src/PhpSpreadsheet/Reader/Security/XmlScanner.php
Co-Authored-By: MarkBaker <mark@lange.demon.co.uk>
2018-11-20 11:46:01 +01:00
MarkBaker
5854ce3738 phpcs cleanup 2018-11-20 08:18:35 +01:00
MarkBaker
0a9e15ca69 srsly?!? phpcs is enforcing alphabetic order of use clauses now? 2018-11-19 23:42:05 +01:00
MarkBaker
a4d97ba896 Clean handle charset in XXE scanner 2018-11-19 22:47:34 +01:00
Guillaume RODRIGUEZ
3bea6f516b
Fix index overflow on data values array
Fix index overflow on data values array for multi level detection.

Fixes #747
Fixes #748
2018-11-11 21:43:44 +11:00
Albert Scherman
31e25ad14b
Support page margin in mPDF
Fixes #750
Fixes #751
2018-11-11 21:30:00 +11:00
Gabriel Caruso
f42adb0daf Simplify some conditions and ternary expressions 2018-11-11 18:25:51 +11: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
Danielle McLean
6703624223
Write generated HTML into Mpdf in chunks, rather than as one gigantic string
Due to a limitation in Mpdf, the HTML string passed to its WriteHTML method
must not exceed a particular length. PhpSpreadsheet produces one HTML string
containing all spreadsheet data when writing to HTML, which can easily exceed
Mpdf's size limit. Thus, it was impossible to write large spreadsheets to PDF
using the Mpdf writer - this change fixes that issue.

Fixes #637
Fixes #706
2018-11-03 18:37:47 +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
Adrien Crivelli
4e8e0dc01b
Fix Countable Int (bis) 2018-10-28 14:06:50 +11:00
Jean-Baptiste Noblot
6088f545b6 Add declaration of undefined variable 2018-10-28 14:03:24 +11:00
Jean-Baptiste Noblot
58268fe9b5 Fix Countable Int 2018-10-28 14:03:24 +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
Sreten Ilić
ed6a3a0148
Support numeric condition in SUMIF, SUMIFS, AVERAGEIF, COUNTIF, MAXIF and MINIF
Fixes #683
Fixes #701
2018-10-28 12:47:53 +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
54efe8824e
Fix unit tests 2018-10-21 17:55:31 +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
Adrien Crivelli
925205ed59
Remove exception that can never happen
Because of type hinting in the constructor the spreadsheet object
can never be null anymore.
2018-10-08 10:50:54 +11:00
Adrien Crivelli
edc608782f
Avoid warning on PHP 7.3 2018-10-07 20:28:04 +11: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
Adrien Crivelli
5e5be142f6
Fix incorrect docblock 2018-10-05 11:18:21 +10:00
Adrien Crivelli
1e5be30290
Remove dead code 2018-10-05 11:08:51 +10: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
Roland Eigelsreiter
9022c39dd8 fixes for continue inside switch statement (#660)
This a bugfix for php 7.3 related errors where using continue inside a switch raises a PHP warning. Either use continue 2 or break. Previously continue behaves like break but the intended usage is to continue the for loop instead.
2018-09-30 01:11:24 +09:00
Derek Bonner
01501b6ff2 Remove locale from format string to prevent formatting error (#644)
When a formatting string has a locale in it an error can occur when outputting. For example when the format string with a locale such as `[$-1010409]#,##0.00;-#,##0.00` appears, a value of 9.98 comes back as $9.98. This is because at https://github.com/PHPOffice/PhpSpreadsheet/blob/1.4.0/src/PhpSpreadsheet/Style/NumberFormat.php#L711 the numberFormat regex will match to the zeros inside the locale ([$-1010409]). Attempts to adjust the numberFormat regex caused regressions in other tests. Adding another step to filter out the locale caused no regression.
2018-09-28 21:28:40 +09:00
jalgaba
9fa8a02fe3 Fix broken sample links on windows due to $baseDir having backslash (#653) 2018-09-28 21:25:50 +09:00
AegirLeet
bebfb1e41a Fix warning when reading xlsx without styles
Fixes https://github.com/PHPOffice/PHPExcel/issues/1134
Fixes #631
2018-08-19 15:43:54 +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
Daniel
46eabbad60
Rowspans/colspans were incorrect when adding worksheet using loadIntoExisting
Rowspans/colspans are now respected for each HTML document added to an existing
spreadsheet as a new worksheet. The protected $rowspan class property should
be emptied on each call to `loadIntoExisting`.

Fixes #619
Fixes #620
2018-08-05 13:41:06 +09:00
Andrew Siegman
adf95bcc0e
Migration tool keep variables containing $PHPExcel untouched
Fixes #598
Fixes #609
2018-08-05 13:27:55 +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
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
Andrew Siegman
043327bb7d
Exclude the vendor folder in migration
Fixes #481
Fixes #586
2018-07-08 13:35:40 +09:00
Vladimir Reznichenko
e0ed25d6b2 Php Inspections (EA Extended): minor code tweaks (#579) 2018-07-04 23:55:33 +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
Derek Bonner
7a4cbd4fd5 Cell formats with escaped spaces were causing incorrect date formatting
Fix issue where escaped spaces in cell format would cause incorrect
date format leading to incorrect time conversions

Fixes #557
Closes #558
2018-06-24 19:35:45 +09:00
Mewes Kochheim
a6bb491539
Fixed method call (setRevisionPassword -> setRevisionsPassword)
Fixes #553
2018-06-18 13:47:58 +09:00
Adrien Crivelli
371c800e3f
Ranges across Z and AA columns incorrectly threw an exception
Fixes #545
2018-06-11 22:54:11 +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
Toni Martí
b700614f0d
Make newer Excel versions properly recalculate formulas on document open
Fixes #456
Closes #515
2018-06-10 12:57:25 +09:00
KoenigsKind
dcc1832215
In PHP7 required parameters must be set
Closes #486
2018-05-26 14:31:34 +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
Jean Baptiste Noblot
0c7df7721b Fix times and power in Shared/JAMA/Matrix
I add $args in count line 1
2018-05-21 18:28:48 +09:00
Jean Baptiste Noblot
37669270f5 Fix PHPDocs Shared/Trend/BestFit 2018-05-21 18:27:02 +09:00
Jean Baptiste Noblot
b8f9b6ada7 Fix PHPDocs in Chart/DateSeries
Wrong return type make PHPStorm Inspect Code not happy
2018-05-21 18:05:14 +09:00
Jean Baptiste Noblot
92633a84d8 Fix Documentation in Shared/Date 2018-05-21 18:03: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
38638268d8
Fix code style 2018-05-13 11:23:10 +09:00
Adrien Crivelli
eda1c8a4d6
Fix spacing according to Scrutinizer 2018-05-12 22:02:46 +09:00
Adrien Crivelli
d7751afbec
Fix tests on PHP 5.6 2018-05-12 22:00:29 +09:00
Chris Wild
275c35c877
Expose sheet title maximum length as Worksheet::SHEET_TITLE_MAXIMUM_LENGTH
Closes #482
2018-05-12 21:27:39 +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
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
MarkBaker
df34b15079 Apply filter check on cells that already contain a subtotal calculation... will add unit tests later 2018-04-13 12:24:54 +01:00
Gints Murāns
e5e8be26d5
Plain text and richtext mixed in same cell can be read
This was introduced in 0084776160

Fixes #442
Closes #453
2018-04-09 10:56:52 +09:00
Adrien Crivelli
ce4b864e01
Minor typo 2018-03-06 08:41:40 +01:00
Adrien Crivelli
6e2447d933
setStrikethrough() did not set the font
Fixes #403
2018-03-04 21:39:32 +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
f58724ae0b
Fix code style 2018-02-25 13:58:42 +01:00
luciferfran
ae1ec5f2cf
Use proper € symbol for currency format
This also place the symbol after the figure as it is by far the most
common usage according to https://en.wikipedia.org/wiki/Language_and_the_euro#Summary

Closes #379
2018-02-25 13:51:47 +01:00
Paul Klimov
eb612157dd array short syntax in documentaiton (#373) 2018-02-25 13:16:04 +01:00
Claudio Zizza
0084776160 Remove Scrutinizer failure condition
Previous commits introduced failure conditions in Scrutinizer,
which dropped the index of Xlsx reader drasticly.
2018-02-20 17:35:30 +09:00
Adrien Crivelli
349e4452e7
Fix a few docblocks 2018-02-12 12:09:35 +09:00
Jan-Sverre Riksfjord
2e37578971
Fix zoom scale problems on reading bad xlsx files
Some computer programs will output xlsx files that do not compare 100%
to the standards. Excel will open the file without any problem.

setZoomScaleNormal() should throw exception when manually setting the
scale to less than or equals 0, but when reading files, we should
be able to read a file with such error, as Excel does.

Closes #350
2018-02-11 14:50:07 +09:00
Chris Wild
608a2edba7
HTML writer creates a generator meta tag
Fixes #312
Closes #362
2018-02-11 14:34:38 +09:00
Toha
38b90715e2 Fix formula string truncated at the end.
Wrong use of substr() in commit 453f8f1821 makes
formula string truncated at the end.

Signed-off-by: Toha <tohenk@yahoo.com>
2018-02-08 12:45:41 +09:00
Adrien Crivelli
02e176197a
Code style 2018-02-05 21:48:47 +09: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
de7758f9b6
Avoid potentially unsupported PSR-16 cache keys
Ensure compatibility with all PSR-16 cache implementation by using
a stricter character set for cache key that match the spec.

Fixes #354
2018-02-01 21:27:36 +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
Adrien Crivelli
015c83ccf4
Fix a few docblocks 2018-01-28 15:26:42 +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
Gabriel Caruso
257c3eca58 Simplify returns 2018-01-17 12:42:54 +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
4635d39b4a
PHP 7.2 compatibility 2018-01-09 14:26:59 +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
98e0a97139
Typo in documentation
Closes #315
2018-01-04 13:34:25 +09:00
Adrien Crivelli
a504a39474
Fix PHPDoc blocks
Closes #314
2018-01-04 02:02:41 +09:00
Adrien Crivelli
ca6114639a
Support for shape style ending with ;
Valid CSS style can end with `;` and that is the case for some 3rd party
software such as WPS Office.

Closes #304
2017-12-28 12:36:57 +09:00
Adrien Crivelli
139d85d874
Better auto-detection of CSV separators
Closes #305
2017-12-28 12:25:37 +09:00
Adrien Crivelli
ac1c7a2c7d
Fix a few phpdoc blocks 2017-12-27 22:20:47 +09:00
Adrien Crivelli
fff3630780
Support migration of prefixed classes 2017-12-25 10:49:14 +09:00
Adrien Crivelli
fb5f8d4763
Support DateTimeImmutable as cell value 2017-12-23 21:50:07 +09:00
Adrien Crivelli
1dfd4dbeb9
Date format compatible with both LibreOffice and Excel
Date formats used invalid single `y`, instead of double `yy`.
That was was implicitly fixed and displayed correctly by Excel. But
LibreOffice does not implicitly fix it and instead display the literal `y`
instead of th year value.

See also: https://support.office.com/en-us/article/Format-numbers-as-dates-or-times-418bd3fe-0577-47c8-8caa-b4d30c528309

Fixes #298
2017-12-23 18:28:56 +09:00
Adrien Crivelli
d9bd45f4f1
Fix unit tests 2017-12-23 14:59:23 +09:00
Adrien Crivelli
80e46707aa
Fix code style 2017-12-23 14:40:51 +09:00
Alessandro Lai
453f8f1821
Simplify substr usages 2017-12-23 14:37:04 +09:00
Alessandro Lai
30ec11c7fa
Optimize regex using \d 2017-12-23 14:36:08 +09:00
Alessandro Lai
cfc325ab57
Fix PHPDoc to avoid erroneous warning in IDE 2017-12-23 14:35:13 +09:00
Alessandro Lai
5bdb3ba210
Simplify return statement 2017-12-23 14:34:49 +09:00
Alessandro Lai
b77352f153
Add regex delimiter for proper escaping 2017-12-23 14:33:50 +09:00
Alessandro Lai
b5057f44b1
Avoid race condition 2017-12-23 14:32:27 +09:00
Alessandro Lai
a653e09bf0
Remove duplicated code and call parent methods where possible 2017-12-23 14:28:28 +09:00
Alessandro Lai
f246ad731d
Remove redundant function calls in for loops 2017-12-23 14:22:21 +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
a204e0c7ec
Constant TYPE_DOUGHTNUTCHART is now TYPE_DOUGHNUTCHART 2017-12-13 19:54:25 +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
Adrien Crivelli
812a468844
New method evaluateGCD() should stay private 2017-12-03 17:20:45 +09:00
MarkBaker
90366f9dd1 style fixes 2017-11-26 23:18:11 +00:00
MarkBaker
19fd27811d Improved GCD() evaluation and additional tests 2017-11-26 22:13:29 +00: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
Maxim Bulygin
442e612202
Support custom PDF library instances or configurations
This allow to create and configure the standard instance of the
external PDF libary, before returning it to the standard writer.

Or, more powerful, this allow to provide a custom implementation
of the external PDF library, allowing for custom behaviors. An
example of that would something like: https://tcpdf.org/examples/example_003/

Closes #266
2017-11-04 16:01:09 +09:00
anton-harvey
f7518dadc9
Return false if the zip entry could not be located
Previously the function did not check whether the return value of `ZipArchive::locateName`
was `false`. And when it was, it was passed straight into `ZipArchive::getFromIndex`,
which casts it to an integer, resulting in it incorrectly retrieving the entry at index `0`.

Fixes #262
Closes #268
2017-11-02 15:42:45 +09:00
Adrien Crivelli
8183c71e78
Remove duplicated declarations of interface implementation 2017-10-31 19:58:46 +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
8d23bda3dd
Fix Scrutinizer issues 2017-10-29 23:34:00 +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
b4a187bef8
Fix missing classes 2017-10-28 22:52:23 +09:00
Adrien Crivelli
a093a468d1
HLOOKUP check on the count of the rows, not columns
We must check on the count of the rows (`row_index_num` and not
`col_index_num` as in VLOOKUP) and not on the columns.

https://support.office.com/en-us/article/HLOOKUP-function-a3034eec-b719-4ba3-bb65-e1ad662ed95f

Fixes https://github.com/PHPOffice/PHPExcel/issues/1339
2017-10-26 23:02:53 +09:00
Adrien Crivelli
25ff914aa6
Simplify IOFactory to rely on autoloading 2017-10-22 01:54:14 +09:00
Adrien Crivelli
3e6a419b6d
Remove useless @static annotations 2017-10-21 23:26:05 +09:00
Adrien Crivelli
79ab852bf5
Expose PDF writer to be used directly
We used to have some kind of wrapper that didn't do much except
forward methods to the real instance. That unnecessary complexity
made it harder to work with the real writer instance.
2017-10-14 14:57:44 +09:00
KacerCZ
98cd5e07bf Temporary directory is passed to mPDF (#248)
Temporary directory set to PDF writer is passed to mPDF object in constructor.
mPDF 7.0 changed temporary directory configuration from constant to constructor parameter.
Without this change it is not possible to change default temporary directory.

See: https://mpdf.github.io/installation-setup/folders-for-temporary-files.html
2017-10-13 16:08:55 +09:00
Adrien Crivelli
add064e80e
Migrate Shared\Date methods
Closes #247
2017-10-13 12:12:58 +09:00
Adrien Crivelli
b14234b198
Removed leading slashes from migrator map
Closes #245
Closes #246
2017-10-13 10:38:58 +09:00
Adrien Crivelli
bd3285b4fa
Avoid underscore in property names 2017-10-08 14:37:11 +09:00
Claudio Zizza
c9795e13b5 Add missing class properties (#241) 2017-10-08 13:18:39 +09:00
Adrien Crivelli
483f3c98ff
More fixes from PhpStorm warnings 2017-10-08 02:00:30 +09:00
Adrien Crivelli
1259549466
Drop unused code and fix some PhpStorm warnings 2017-10-08 01:21:32 +09:00
Maxim
4b4bac53aa INDEX(): fix getting row and col numbers from references (#239)
Allow to use cell references as row and column in function INDEX(). Eg:

```
=INDEX(A1:B5, A9)
```
2017-10-06 14:01:20 +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
50a0ec58af
Merge all examples together
Closes #17
2017-10-01 17:48:59 +09:00
Adrien Crivelli
29208e9d99
Remove boilerplates
Because it is a budren to maintain and LGPL 2.1 does not require
them, but only suggest them:

> To apply these terms, attach the following notices to the library.
> It is **safest** to attach them to the start of each source file
> to most effectively convey the exclusion of warranty; and each
> file **should** have at least the "copyright" line and a pointer
> to where the full notice is found.

https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html#SEC4
2017-09-30 22:12:28 +09:00
Maxim
810f174d6e Fix INDEX() function when rows count less than row number (#233) 2017-09-30 12:13:20 +09:00