Commit Graph

409 Commits

Author SHA1 Message Date
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
Adrien Crivelli 360db8dbcd
Upgrade to mPDF 7.0+
Closes #144
2017-09-29 11:17:08 +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
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
Adrien Crivelli febbe87172
Remove unused variable 2017-09-12 01:06:48 +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 097d349e9c
Fix code style 2017-09-11 13:41:44 +09:00
MarkBaker 77b3c12fbc More perforan version of stringFromColumnIndex that takes advantage of the PHP 5.3 modified ternary 2017-09-10 22:51:05 +01:00
MarkBaker d576855031 Merge branch 'develop' of https://github.com/PHPOffice/PhpSpreadsheet into develop 2017-09-10 22:27:50 +01: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 e558028eb7
Remove extraneous parameter 2017-09-09 18:23:07 +09:00
Davis Devasia 41a1aa9ede Uncommented the increment of $imageCounter (#205)
The static variable $imageCounter previously had a constant value of 0 throughout the program as it was never being modified, because it was commented out by mistake.

Now it increments every time a new drawing is being instantiated.

This also fixed a problem when multiple images of same name in the same worksheet are incorrectly displayed.

Fixes #204
Closes #205
2017-09-08 20:43:12 +02:00
Adrien Cohen 5dd18586a2
Fix colIndex read as signed int16 for relative ref
As described in http://interoperability.blob.core.windows.net/files/MS-XLS/[MS-XLS].pdf
a relative column reference can be between -255 +255 and not -127 + 127, the column
index should be read as a signed int16.

References:

- 2.2.2.2.1 Value Class / page 81
- 2.5.198.88 PtgRefN / page 815
- 2.5.198.111 RgceLocRel / page 828

Fixes #211
Closes #214
2017-09-09 03:34:52 +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
CrazyBite e6c95bf9b0
Added fillColor for chart plot series
For now it is only to write to Xlsx

Closes #158
2017-09-08 02:52:27 +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
Vladimir Reznichenko 004a192922 SCA with Php Inspections (EA Extended)
Closes #208
2017-09-07 19:11:48 +02:00
Adrien Crivelli c8089f97d8
Prevent notice when no rules
Closes https://github.com/PHPOffice/PHPExcel/pull/1287
2017-08-17 12:55:27 +02:00
Adrien Crivelli cf2c0e51f4
Fix variadic docblocks 2017-08-03 12:59:52 +02:00
Adrien Crivelli 4a47a32953
Code style partially according to Scrutinizer 2017-08-03 12:03:24 +02:00
Adrien Crivelli 5520bf5c99
Fix wrong return type
Closes https://github.com/PHPOffice/PHPExcel/pull/1262
2017-07-30 21:29:37 +02:00
Ben 0b03571394 removed wrong parameter hint (#187) 2017-07-17 16:07:17 +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
Kifni Taufik Darmawan 2a6ab1776c
HTML reader supports text and background color from inline CSS, for `td` and `th` element
Closes #180
2017-06-23 11:28:17 +02:00
Mewes Kochheim 6aae764920
Use default values when writing validation in Xls
Fixes the PHP 7.1 bug reported over at PHPOffice/PHPExcel#1110
The behavior should not change since the default value used should behave the same way as the string value in earlier PHP versions.

Fixes a return type in the doc block of IReader.

Closes #165
2017-06-20 10:48:45 +02:00
Adrien Crivelli 44e2461b7b
Refactor `define()` as class constants
This will improve interoperability with other projects and simplify our code.

Closes #157
2017-05-19 23:49:12 +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
azine.me 77199c9877
Ods writer repects PreCalculateFormulas flag
The OpenDocument Writer did not respect the "preCalculateFormulas" flag that
can be set to speed up saving process, now it does.

Closes #142
2017-05-07 17:07:27 +02:00