Commit Graph

16 Commits

Author SHA1 Message Date
oleibman a8462f3864
Apply Column and Row Styles to Existing Cells (#1721)
* Apply Column and Row Styles to Existing Cells

This is a fix for issue #1712.
When a style is applied to an entire row or column, it is currently
only effective for cells which don't already contain a value.
The code needs to iterate through existing cells in the row/column
in order to apply the style to them.
This could be considered a breaking change, however, I believe that
the change makes things operate as users would expect, and that the
existing implementation is incomplete.

The change also removes protected element conditionalStyles from
the Style class. That element is an unused remnant, and can no longer be
set or retrieved - methods getConditionalStyles and setConditionalStyles
actually act on an element in the Worksheet class.

Finally, additional tests are added so that Style, and in fact the
entire Style directory, now has 100% test coverage.

* Scrutinizer Changes

Scrutinizer flagged 6 statements. 5 can be easily corrected.
One is absolutely wrong (it thinks iterating through cells in column
can return null). Let's see if we can satisfy it.

* Remove Exception For CellIterator on Empty Row/Column

For my first attempt at this change, which corrects a bug by updating styles
for non-empty cells when a style is set on a row or column, I wished to make things
more efficient by using setIterateOnlyExistingCells, something which the
existing documentation recommends. This caused an exception to be generated
when the row or column is empty. So I removed that part of the change while I
researched what was going on.

I have completed that research. The existing code does throw an exception
when the row/column is empty and iterateOnlyExistingCells is true. However,
that does not seem like a reasonable action. This situation is analagous to
iterating over an empty array, and that action is legal and does not throw.
The same should apply here. There were no tests for this situation,
and now there are.

I have added additional tests, and coverage for all of RowCellIterator,
ColumnCellIterator, and CellIterator are all now 100%. Some of my new tests
were added in new members, because the existing tests all relied on mocking,
which was not the best choice for the new tests. One of the existing tests
for RowCellIteratorTest (testSeekOutOfRange) was wrong; it issued the expected
exception, but for the wrong reason. I have added an additional test to
ensure that it fails "correctly".

The existing documentation says that the default value for
IterateOnlyExistingCells is true. In fact, the default value is false.
I have corrected the documentation.

* More Scrutinizer

I believe its analysis is incorrect, but this should silence it.

* DocBlock Correction

ColumnCellIterator DocBlock for current indicated it could return null
or Cell, but it can really return only Cell. This had caused Scrutinizer
to complain earlier.

* PHP8 Environment Appears to be Fixed

Cosmetic change to Doc member. I suspect there is a way to rerun all
the tests without another push, but I have been unable to figure out how.
2020-12-10 18:19:56 +01:00
Adrien Crivelli dcf3b9860d
Code highlight in docs for PhpStorm 2020-05-31 22:44:25 +09:00
MarkBaker 38e71a1210 Fix Documentation type 2019-07-09 19:39:12 +02:00
Mark Baker c9dc1e6130
String value binder (#901)
* Document calculation caching; and how to disable it and how to flush the cache

* Quoted text for string values beginning with `=`, so that they are still treated as strings and not as formulae

* Warning about assigning cells to variables

* Further warning about assigning cells to variables

* getCell() with a second argument

* Added String Value Binder, and a Reader example demonstrating how to use it

* Ensure value is a string before binding

* Sample file for String Value Binder

* PHPCS moaning about order or use statements

* Order of annotations, that PHPStorm determined, isn't what phpcs says it should be
2019-02-23 18:40:07 +01:00
Mark Baker 58a5172b8f
Document Improvements … (#899)
* Document calculation caching; and how to disable it and how to flush the cache

* Quoted text for string values beginning with `=`, so that they are still treated as strings and not as formulae

* Warning about assigning cells to variables

* Further warning about assigning cells to variables
2019-02-23 10:22:18 +01:00
Adrien Crivelli 57a0297011
HTML entities should not be escaped in Markdown 2018-07-24 10:13:58 +09:00
Paul Klimov eb612157dd array short syntax in documentaiton (#373) 2018-02-25 13:16:04 +01:00
Adrien Crivelli 98e0a97139
Typo in documentation
Closes #315
2018-01-04 13:34:25 +09:00
Adrien Crivelli c46008b2be
Quote class names in docs 2017-12-30 19:44:32 +09:00
Adrien Crivelli d383bc356c
Restore reference to calculation engine 2017-12-20 00:20:38 +09:00
Terje Bråten 8288a7f029 Documentation change for column indexing 2017-12-19 12:07:19 +09:00
Adrien Crivelli 67767e1402
Incorrect class in documentation 2017-12-17 23:11:25 +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 557e80dc03
Rename classes to keep them in their related namespaces 2017-10-29 17:39:42 +09:00
Adrien Crivelli 8e8d0e4a30
Improve doc formatting with backticks 2017-03-13 14:57:37 +09:00
Adrien Crivelli b8adec4938
Update documentation with composer instructions
And split first page into several topics to improve sidebar navigation

Closes #114
2017-03-13 12:30:26 +09:00