Adding option to stop at a conditional styling, if it matches (only Xlsx-Files)#292
Adding option to stop at a conditional styling, if it matches (only Xlsx-Files)#292sbreiler wants to merge 11 commits intoPHPOffice:developfrom
Conversation
PowerKiKi
left a comment
There was a problem hiding this comment.
Thanks for the contribution, before being merge, we should address my comments and add unit tests. Also it might make it easier to unit tests if the writer was also implemented. That would be an even nicer contribution.
| /** | ||
| * Stop on this condition, if it matches | ||
| * | ||
| * @var int |
There was a problem hiding this comment.
Should be a boolean instead of leaking file format into our model
| const OPERATOR_BETWEEN = 'between'; | ||
|
|
||
| const IF_TRUE_STOP = 1; | ||
| const IF_TRUE_DONT_STOP = 0; |
There was a problem hiding this comment.
Should be dropped in favor of boolean
| $objWriter->writeAttribute('text', $conditional->getText()); | ||
| } | ||
|
|
||
| if( $conditional->getStopIfTrue() === Conditional::IF_TRUE_STOP ) { |
There was a problem hiding this comment.
Fix code style with composer fix command
There was a problem hiding this comment.
Sadly it seems i can't run composer fix on windows - are the three equal-signs a problem?
|
@PowerKiKi can you have a look at the changes? As mentioned, i can't seem to run |
PowerKiKi
left a comment
There was a problem hiding this comment.
I you can't run composer, then try ./vendor/bin/php-cs-fixer fix which would have the same effect.
It would be best to write unit tests without writing files to disk, but if you cannot, then you could get inspiration from \PhpOffice\PhpSpreadsheetTests\Functional\Enclosure.
| const OPERATOR_BETWEEN = 'between'; | ||
|
|
||
| const IF_TRUE_STOP = true; | ||
| const IF_TRUE_DONT_STOP = false; |
There was a problem hiding this comment.
I meant those two const should be deleted entirely. There is no need to define a const for true.
|
@PowerKiKi Could you have a look at the latest changes? |
|
Thanks for your cooperation ! I tweaked it a little bit and merged it. |
- Support for PHP 7.2 - Support cell comments in HTML writer and reader - [#308](#308) - Option to stop at a conditional styling, if it matches (only XLSX format) - [#292](#292) - Support for line width for data series when rendering Xlsx - [#329](#329) - Better auto-detection of CSV separators - [#305](#305) - Support for shape style ending with `;` - [#304](#304) - Freeze Panes takes wrong coordinates for XLSX - [#322](#322) - `COLUMNS` and `ROWS` functions crashed in some cases - [#336](#336) - Support XML file without styles - [#331](#331) - Cell coordinates which are already a range cause an exception [#319](#319)
This would be used like `$conditonal->setStopIfTrue()` and is only supported for XLSX format for now. Closes PHPOffice#292
- Support for PHP 7.2 - Support cell comments in HTML writer and reader - [PHPOffice#308](PHPOffice#308) - Option to stop at a conditional styling, if it matches (only XLSX format) - [PHPOffice#292](PHPOffice#292) - Support for line width for data series when rendering Xlsx - [PHPOffice#329](PHPOffice#329) - Better auto-detection of CSV separators - [PHPOffice#305](PHPOffice#305) - Support for shape style ending with `;` - [PHPOffice#304](PHPOffice#304) - Freeze Panes takes wrong coordinates for XLSX - [PHPOffice#322](PHPOffice#322) - `COLUMNS` and `ROWS` functions crashed in some cases - [PHPOffice#336](PHPOffice#336) - Support XML file without styles - [PHPOffice#331](PHPOffice#331) - Cell coordinates which are already a range cause an exception [PHPOffice#319](PHPOffice#319)
This would be used like `$conditonal->setStopIfTrue()` and is only supported for XLSX format for now. Closes PHPOffice#292
- Support for PHP 7.2 - Support cell comments in HTML writer and reader - [PHPOffice#308](PHPOffice#308) - Option to stop at a conditional styling, if it matches (only XLSX format) - [PHPOffice#292](PHPOffice#292) - Support for line width for data series when rendering Xlsx - [PHPOffice#329](PHPOffice#329) - Better auto-detection of CSV separators - [PHPOffice#305](PHPOffice#305) - Support for shape style ending with `;` - [PHPOffice#304](PHPOffice#304) - Freeze Panes takes wrong coordinates for XLSX - [PHPOffice#322](PHPOffice#322) - `COLUMNS` and `ROWS` functions crashed in some cases - [PHPOffice#336](PHPOffice#336) - Support XML file without styles - [PHPOffice#331](PHPOffice#331) - Cell coordinates which are already a range cause an exception [PHPOffice#319](PHPOffice#319)
This is:
Checklist:
What does it change?
Can read & write conditional cell formating with "stopIfTrue"-Option, which would prevent any further condition checks if matched. Only implemented for Xlsx-Files (Xlsx Writer/Reader).