Commit Graph

2412 Commits

Author SHA1 Message Date
MarkBaker 4c8617551d Update change log 2020-12-10 18:20:18 +01:00
MarkBaker 0861370c4d Update change log 2020-12-10 18:13:12 +01:00
oleibman 497a934374
Fix for 3 Issues Involving ReadXlsx and NamedRange (#1742)
* Fix for 3 Issues Involving ReadXlsx and NamedRange

Issues #1686 and #1723, which provide sample spreadsheets, are probably
solved by this ticket. Issue #1730 is also probably solved, but I have
no way to verify.

There are two problems with how PhpSpreadsheet is handling things now.
Although the first problem is much less severe, and isn't really a factor
in the issues named above, it is helpful to get it out of the way first.
If you define a named range in Excel, and then delete the sheet where
the range exists, Excel saves the range as #REF!. If there is a cell which
references the range, it will similarly have the value #REF! when you open
the Excel file.
Currently, PhpSpreadsheet discards the #REF! definition, so a cell which
references the range will appear as #NAME? rather than #REF!.
This PR changes the behavior so that PhpSpreadsheet retains the #REF!
definition, and cells which reference it will appear as #REF!.

The second problem is the more severe, and is, I believe, responsible
for the 3 issues identified above.
If you define a named range and the sheet on which the range is defined
does not exist at the time, Excel will save the range as something like:

'[1]Unknown Sheet'!$A$1

If a cell references such a range, Excel will again display #REF!.
PhpSpreadsheet currently throws an Exception when it encounters
such a definition while reading the file. This PR changes
the behavior so that PhpSpreadsheet saves the definition as #REF!,
and cells which reference it will behave similarly.

For the record, I will note that Excel does not magically recalculate when a
missing sheet is subsequently added, despite the fact that the reference
might now become resolvable. PhpSpreadsheet behaves likewise.

* Remove Dead Code in Test

Identified it after push but before merge.
2020-12-10 18:08:10 +01:00
MarkBaker ff04c8502a Update change log 2020-12-10 18:05:44 +01:00
oleibman ce7863570a
Fix for 1735 (Incorrect activeSheetIndex after RemoveSheetByIndex) (#1743)
This is a fix for issue #1735.
It adds tests for this situation, and similar situations involving
adding new sheets and accessing existing ones.
Coverage for Spreadsheet.php increases from 69% to 75% as a result.
2020-12-10 18:01:08 +01:00
Adrien Crivelli baa9c452e5
Merge pull request #1745 from rhynodesigns/patch-1
Spelling: Tou -> You
2020-12-09 16:48:30 +09:00
Ryan McAllen 7247e3b5ac
Spelling: Tou -> You 2020-12-07 10:17:56 -05:00
Adrien Crivelli 40abd18fe0
Merge pull request #1734 from oleibman/morecoverage
Improve Coverage in src/PhpSpreadsheet
2020-12-02 09:46:22 +09:00
Owen Leibman 6b4feb6142 Changes for Scrutinizer
Two changes to fix minor problems reported by Scrutinizer.
2020-11-27 07:16:23 -08:00
Owen Leibman 1a0aab1a4f Improve Coverage in src/PhpSpreadsheet
There are no changes to code. Additional tests are added,
so that the following 6 items now have 100% test coverage:
- Comment
- DefinedName
- DocumentGenerator
- IOFactory
- NamedFormula
- NamedRange
2020-11-27 06:50:01 -08:00
Adrien Crivelli ba1ce8b8ec
Automatic GitHub releases from git tags 2020-11-26 12:44:07 +09:00
Adrien Crivelli bd05c590e3
Drop Travis 2020-11-26 11:10:52 +09:00
Mark Baker 0ed5b800be
Resolve XSS Vulnerability in the HTML Writer (#1719)
Resolve XSS Vulnerability in the HTML Writer
2020-11-19 11:59:57 +01:00
oleibman 6fe653179f
Make DefinedNames Samples Consistent With Other Samples (#1707)
All other Samples write to temporary directory. DefinedNames samples
write to main directory, which (a) means they aren't stored with others,
and (b) they aren't ignored by git so look like changed files.
The tests are also simplified by requiring Header rather than Bootstrap,
making use of Helper.
2020-11-11 11:02:04 +01:00
oleibman cca43f0b5b
Merge pull request #4 from PHPOffice/master
Sync with Base
2020-11-01 18:02:37 -08:00
CoryHrycko 0bf3986efa
Updating a misspelling of a function name. (#1695)
This will update the function name DCOUNTA from the misspelling of DCOUNT.
2020-11-01 12:05:04 +01:00
oleibman ae0cd46423
Add exportArray Method for Styles (#1580)
Issue #580 has gone stale since I started work on this.
Nevertheless, this implements an exportArray function as an
exact counterpart of applyFromArry.
I chose the name exportArray to avoid confusion with the existing
method getStyleArray, which does something completely different.

This change also increases coverage for all the Style classes to 100%,
with the exception of Style.php itself. There were several (unchanged)
places in Style.php where I did not have sufficient understanding of
what was supposed to be happening, so could not create tests.

All properties used by applyFromArray are exported by this method.
Note that conditional styles are not covered; this is consistent
with the fact that they are not covered by applyFromArray.

The method is implemented as a final public function in Style/Supervisor,
which calls abstract protected function exportArray1, which is implemented
in each of the subclasses, and which calls final protected
function exportArray2 in Style/Supervisor.
So exportArray is usable for any of the subclasses as well.

The new method is added to the documentation.
The existing documentation for applyFromArray was alphabetized to make
it easier to follow.
One property (Style quotePrefix) was added to the documentation.
Some Borders pseudo-properties (vertical, horizontal, and outline) were
documented as usable by applyFromArray,
but aren't actually supported - they were removed.
The documentation of the properties seemed to use setProperty and
getProperty fairly randomly - it now uses setProperty exclusively.

New constants were added for the textRotation "angles" used to create a
"stacked" cell. I felt that changing the readers and writers to use
these constants was beyond the scope of this change, but it is
on my to-do list.
2020-10-26 20:56:24 +01:00
Adrien Crivelli cc209d0b43
Refresh lock files 2020-10-19 09:31:34 +09:00
Jan-Simon Winkelmann 96e843ceee Prevent notice during accessing "cached magnification factor" offset
Sheet View Settings Block should be 8-14 bytes long in BIFF8 Excel 97 according
to the open office file format documentation. However access to byte 10 and 12 is
not possible when record data is malformed, so getUInt2d throws notice.
2020-10-12 20:53:30 +09:00
Mark Baker 92389c78eb
Ensure that the list of shared formulae is maintained while chunk-reading Xlsx Files (#1680)
* Ensure that the list of shared formulae is maintained while chunk-reading Xlsx files
2020-10-12 13:22:32 +02:00
Adrien Crivelli 1cda811017
Prepare for next version 2020-10-12 08:06:57 +09:00
Adrien Crivelli 6da3f30def
Remove coverage from Travis
Coverage data were not correctly uploaded for a long time now, and it
now is uploaded via GitHub Actions
2020-10-11 22:32:04 +09:00
Adrien Crivelli a8e8068b31
1.15.0 2020-10-11 22:20:59 +09:00
Adrien Crivelli da7adcda80
Update CHANGELOG 2020-10-11 22:11:20 +09:00
oleibman 1741766a9c
Improving Coverage for Excel2003 XML Reader (#1557)
* Improving Coverage for Excel2003 XML Reader

Reader/Xml is now 100% covered.

File templates/Excel2003XMLTest.xml, used in some tests, is *not*
readable by a current version of Excel. I have substituted a new file
excel2003.xml to be used in its place. I have not deleted the original
in case someone in future (possibly me) wants to see what it needs to
make it usable.

There are minimal code changes.
- Unused protected functions pixel2WidthUnits and widthUnits2Pixel
  are deleted.
- One regex looking to convert hex characters is changed from a-z to a-f,
  and made case insensitive.
- No calculation performed for "error" cell (previously calculation
  was attempted and threw exception).
- Empty relative row/cell is now handled correctly.
- Style applied to empty cell when appropriate.
- Support added for textRotation.
- Support added for border styles.
- Support added for diagonal borders.
- Support added for superscript and subscript.
- Support added for fill patterns.

In theory, encodings other than UTF-8 were supported.
In fact, I was unable to get SecurityScanner to pass *any* xml which is
not UTF-8. Eliminating the assumption that strings might not be UTF-8
allowed much of the code to be greatly simplified.
After that, I added some code that would permit the use of
some ASCII-compatible encodings (there is a test of ISO-8859-1).
It would be more difficult to handle other encodings (such as UTF-16).
I am not convinced that even the ISO-8859 effort is worth it,
but am willing to investigate either expanding or eliminating
non-UTF8 support.

I added a number of tests, creating an Xml directory, and moving
XmlTest to that directory.

Pull Request had problems reading old invalid sample in the code
coverage phase, not in any of the other test phases, and not in
the code coverage phase on my local machine.
As it turns out, aside from being invalid, the sample
is much larger than any of the other samples. Tests have been
adjusted accordingly.

* Smaller Test File

Should eliminate need to avoid test during xml coverage.

* Break Up Style Test into Multiple Tests

Per suggestion from Mark Baker.

* Integrate AddressHelper Change

The introduction of AddressHelper introduced a conflict which needed to
be resolved. I wanted to test it locally before resolving. This required
me to add (unchanged) AddressHelper to my local copy. I hope this is
an okay manner of resolving the conflict.

* Weird Travis Error

XmlOddTest works just fine on my local machine, but Travis failed it.
Even worse, the lines which Travis flags don't even make any sense
(one was the empty line between two methods!).
This test is not essential to the rest of the change. I am removing
it from the package, and will attempt to re-add it when I have a chance
to sync up my fork with the main project.
2020-10-11 13:26:56 +02:00
Adrien Crivelli 7545c411f9 Test PHP 8 on GitHub Actions 2020-10-11 19:46:56 +09:00
MarkBaker b53199d7db Update composer suggestions 2020-10-11 12:36:47 +02:00
Adrien Crivelli 591f7cf301
Merge pull request #1675 from PHPOffice/PHP8-Testing
Php8 testing
2020-10-11 18:34:42 +09:00
Adrien Crivelli c3d1ce536b
Publish API docs via GitHub Actions 2020-10-11 12:06:27 +09:00
Adrien Crivelli df2fd911d0
Merge pull request #1676 from PHPOffice/github-actions
Introduce GitHub Actions
2020-10-10 23:20:38 +09:00
Adrien Crivelli 794ac801a5
Annotate problems in code 2020-10-10 22:51:04 +09:00
Adrien Crivelli 44080a1e8b
Introduce GitHub Actions
The plan is to keep Travis for a short while, until we are confident that
GitHub Actions work well enough for us. And after that we can remove Travis
entirely.

There is a bunch of duplicated things but it allows us to maximize
parallelismt to have results as soon as possible.

API documentation generation is still missing.
2020-10-10 21:03:14 +09:00
MarkBaker 2d93c36a1a Update composer suggestions 2020-10-10 12:11:00 +02:00
MarkBaker ebb7569dba Switch from using poser badges to shields.io because poser wasn't picking up the correct license 2020-10-09 17:55:06 +02:00
MarkBaker dcc47fb287 Codestyle clean-ups 2020-10-09 16:08:20 +02:00
MarkBaker 930fdc1b0c Locale-specific float to string is changed in PHP as per https://wiki.php.net/rfc/locale_independent_float_to_string 2020-10-09 15:59:59 +02:00
MarkBaker e3b9b0d29c Need to add `application/csv` to the list of valid CSV mime types 2020-10-09 14:57:45 +02:00
MarkBaker 6e6c68e7b3 Let's try to figure out why we're having an issue with a temp csv file 2020-10-09 14:52:01 +02:00
MarkBaker ee13533db3 Remove tests that include tcPDF and DomPDF libraries when running against PHP8, because neither library is yet PHP8-ready 2020-10-09 14:31:16 +02:00
MarkBaker 87a909aaf8 Use ZipArchive methods as zip_* functions are deprecated in PHP8 2020-10-09 12:58:33 +02:00
MarkBaker 57d1854bae Merge branch 'master' into PHP8-Testing 2020-10-08 15:02:50 +02:00
Roland Eigelsreiter ab4d7413b0
fixed php8 deprecation warning for libxml_disable_entity_loader() (#1625)
* fixed php8 deprecation warning for libxml_disable_entity_loader()
2020-10-08 15:02:14 +02:00
MarkBaker 723ca37530 Allow failures on nightly fails if we remove it from the grid 2020-10-08 06:10:16 +02:00
MarkBaker 8d0bb374e4 Allow failures on nightly 2020-10-08 06:09:16 +02:00
MarkBaker 3db9fb7958 Work with existing composer file; but force a fresh install to require new dependency versions 2020-10-08 05:51:06 +02:00
MarkBaker fdee43cfa1 Merge branch 'master' into PHP8-Testing 2020-10-08 03:09:21 +02:00
MarkBaker f399acccc9 We don't want the composer lock file for PHP8 2020-10-08 03:00:53 +02:00
MarkBaker 71f21fb94a Separate compoer.json for PHP8 to enforce phpunit ^9.3 2020-10-08 02:56:13 +02:00
Adrien Crivelli 12bdcaa783
Sync README 2020-10-05 10:27:27 +09:00
Adrien Crivelli 9f6da8a7c2
Update CHANGELOG 2020-10-05 10:27:19 +09:00