#984 add support notContainsText for conditional styles in xlsx reader
This commit is contained in:
parent
759c192a44
commit
a757692992
|
|
@ -45,6 +45,7 @@ class ConditionalStyles
|
||||||
|| (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT
|
|| (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT
|
||||||
|| (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSBLANKS
|
|| (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSBLANKS
|
||||||
|| (string) $cfRule['type'] == Conditional::CONDITION_NOTCONTAINSBLANKS
|
|| (string) $cfRule['type'] == Conditional::CONDITION_NOTCONTAINSBLANKS
|
||||||
|
|| (string) $cfRule['type'] == Conditional::CONDITION_NOTCONTAINSTEXT
|
||||||
|| (string) $cfRule['type'] == Conditional::CONDITION_EXPRESSION)
|
|| (string) $cfRule['type'] == Conditional::CONDITION_EXPRESSION)
|
||||||
&& isset($this->dxfs[(int) ($cfRule['dxfId'])])
|
&& isset($this->dxfs[(int) ($cfRule['dxfId'])])
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Conditional;
|
||||||
|
use PhpOffice\PhpSpreadsheetTests\Functional\AbstractFunctional;
|
||||||
|
|
||||||
|
class ConditionalTest extends AbstractFunctional
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test check if conditional style with type 'notContainsText' works on xlsx
|
||||||
|
*/
|
||||||
|
public function testConditionalNotContainsText(): void
|
||||||
|
{
|
||||||
|
$filename = 'tests/data/Reader/XLSX/conditionalFormatting3Test.xlsx';
|
||||||
|
$reader = IOFactory::createReader('Xlsx');
|
||||||
|
$spreadsheet = $reader->load($filename);
|
||||||
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
|
$styles = $worksheet->getConditionalStyles('A1:A5');
|
||||||
|
|
||||||
|
$this->assertCount(1, $styles);
|
||||||
|
|
||||||
|
/** @var $notContainsTextStyle Conditional */
|
||||||
|
$notContainsTextStyle = $styles[0];
|
||||||
|
$this->assertEquals('A', $notContainsTextStyle->getText());
|
||||||
|
$this->assertEquals(Conditional::CONDITION_NOTCONTAINSTEXT, $notContainsTextStyle->getConditionType());
|
||||||
|
$this->assertEquals(Conditional::OPERATOR_NOTCONTAINS, $notContainsTextStyle->getOperatorType());
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Loading…
Reference in New Issue