@@ -137,8 +137,7 @@ |
||
137 | 137 | $this->rotation = 0; |
138 | 138 | $this->shadow = new Drawing\Shadow(); |
139 | 139 | |
140 | - // Set image index |
|
141 | - ++self::$imageCounter; |
|
140 | + // Set image index++self::$imageCounter; |
|
142 | 141 | $this->imageIndex = self::$imageCounter; |
143 | 142 | } |
144 | 143 |
@@ -4,53 +4,53 @@ |
||
4 | 4 | |
5 | 5 | return [ |
6 | 6 | [ |
7 | - 19, // Result for Excel |
|
8 | - 19, // Result for OpenOffice |
|
7 | + 19, // Result for Excel |
|
8 | + 19, // Result for OpenOffice |
|
9 | 9 | 22269, |
10 | 10 | ], |
11 | 11 | [ |
12 | - 1, // Result for Excel |
|
13 | - 1, // Result for OpenOffice |
|
12 | + 1, // Result for Excel |
|
13 | + 1, // Result for OpenOffice |
|
14 | 14 | 30348, |
15 | 15 | ], |
16 | 16 | [ |
17 | - 10, // Result for Excel |
|
18 | - 10, // Result for OpenOffice |
|
17 | + 10, // Result for Excel |
|
18 | + 10, // Result for OpenOffice |
|
19 | 19 | 30843, |
20 | 20 | ], |
21 | 21 | [ |
22 | - 11, // Result for Excel |
|
23 | - 11, // Result for OpenOffice |
|
22 | + 11, // Result for Excel |
|
23 | + 11, // Result for OpenOffice |
|
24 | 24 | '11-Nov-1918', |
25 | 25 | ], |
26 | 26 | [ |
27 | - 28, // Result for Excel |
|
28 | - 28, // Result for OpenOffice |
|
27 | + 28, // Result for Excel |
|
28 | + 28, // Result for OpenOffice |
|
29 | 29 | '28-Feb-1904', |
30 | 30 | ], |
31 | 31 | [ |
32 | - '#VALUE!', // Result for Excel |
|
33 | - '#VALUE!', // Result for OpenOffice |
|
32 | + '#VALUE!', // Result for Excel |
|
33 | + '#VALUE!', // Result for OpenOffice |
|
34 | 34 | 'Invalid', |
35 | 35 | ], |
36 | 36 | [ |
37 | - '#NUM!', // Result for Excel |
|
38 | - 29, // Result for OpenOffice |
|
37 | + '#NUM!', // Result for Excel |
|
38 | + 29, // Result for OpenOffice |
|
39 | 39 | -1, |
40 | 40 | ], |
41 | 41 | [ |
42 | - 1, // Result for Excel |
|
43 | - 31, // Result for OpenOffice |
|
42 | + 1, // Result for Excel |
|
43 | + 31, // Result for OpenOffice |
|
44 | 44 | 1, |
45 | 45 | ], |
46 | 46 | [ |
47 | - 0, // Result for Excel |
|
48 | - 30, // Result for OpenOffice |
|
47 | + 0, // Result for Excel |
|
48 | + 30, // Result for OpenOffice |
|
49 | 49 | 0.5, |
50 | 50 | ], |
51 | 51 | [ |
52 | - 0, // Result for Excel |
|
53 | - 30, // Result for OpenOffice |
|
52 | + 0, // Result for Excel |
|
53 | + 30, // Result for OpenOffice |
|
54 | 54 | 0, |
55 | 55 | ], |
56 | 56 | ]; |
@@ -491,7 +491,7 @@ |
||
491 | 491 | $objWriter->writeAttribute('text', $conditional->getText()); |
492 | 492 | } |
493 | 493 | |
494 | - if( $conditional->getStopIfTrue() == true ) { |
|
494 | + if ($conditional->getStopIfTrue() == true) { |
|
495 | 495 | $objWriter->writeAttribute('stopIfTrue', '1'); |
496 | 496 | } |
497 | 497 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | class ConditionalStopIfTrue extends AbstractFunctional |
8 | 8 | { |
9 | - const |
|
9 | + const |
|
10 | 10 | COLOR_GREEN = 'FF99FF66', |
11 | 11 | COLOR_RED = 'FFFF5050' |
12 | 12 | ; |
@@ -25,50 +25,50 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function testConditionalStopIfTrue($format) |
27 | 27 | { |
28 | - $pCoordinate = 'A1:A3'; |
|
28 | + $pCoordinate = 'A1:A3'; |
|
29 | 29 | |
30 | - // if blank cell -> no styling |
|
31 | - $condition0 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); |
|
32 | - $condition0->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION); |
|
33 | - $condition0->addCondition('LEN(TRIM(A1))=0'); |
|
34 | - $condition0->setStopIfTrue(true); // ! stop here |
|
30 | + // if blank cell -> no styling |
|
31 | + $condition0 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); |
|
32 | + $condition0->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION); |
|
33 | + $condition0->addCondition('LEN(TRIM(A1))=0'); |
|
34 | + $condition0->setStopIfTrue(true); // ! stop here |
|
35 | 35 | |
36 | - // if value below 0.6 (matches also blank cells!) -> red background |
|
37 | - $condition1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); |
|
38 | - $condition1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); |
|
39 | - $condition1->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN); |
|
40 | - $condition1->addCondition(0.6); |
|
41 | - $condition1->getStyle()->getFill() |
|
42 | - ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) |
|
43 | - ->getEndColor()->setARGB(self::COLOR_RED); |
|
36 | + // if value below 0.6 (matches also blank cells!) -> red background |
|
37 | + $condition1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); |
|
38 | + $condition1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); |
|
39 | + $condition1->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN); |
|
40 | + $condition1->addCondition(0.6); |
|
41 | + $condition1->getStyle()->getFill() |
|
42 | + ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) |
|
43 | + ->getEndColor()->setARGB(self::COLOR_RED); |
|
44 | 44 | |
45 | - // if value above 0.6 -> green background |
|
46 | - $condition2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); |
|
47 | - $condition2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); |
|
48 | - $condition2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHAN); |
|
49 | - $condition2->addCondition(0.6); |
|
50 | - $condition2->getStyle()->getFill() |
|
51 | - ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) |
|
52 | - ->getEndColor()->setARGB(self::COLOR_GREEN); |
|
45 | + // if value above 0.6 -> green background |
|
46 | + $condition2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); |
|
47 | + $condition2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); |
|
48 | + $condition2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHAN); |
|
49 | + $condition2->addCondition(0.6); |
|
50 | + $condition2->getStyle()->getFill() |
|
51 | + ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) |
|
52 | + ->getEndColor()->setARGB(self::COLOR_GREEN); |
|
53 | 53 | |
54 | 54 | $spreadsheet = new Spreadsheet(); |
55 | 55 | $spreadsheet->getActiveSheet()->getCell('A1')->setValue(0.7); |
56 | - $spreadsheet->getActiveSheet()->getCell('A2')->setValue(''); |
|
57 | - $spreadsheet->getActiveSheet()->getCell('A3')->setValue(0.4); |
|
56 | + $spreadsheet->getActiveSheet()->getCell('A2')->setValue(''); |
|
57 | + $spreadsheet->getActiveSheet()->getCell('A3')->setValue(0.4); |
|
58 | 58 | |
59 | - // put all three conditions in sheet |
|
60 | - $conditionalStyles = []; |
|
61 | - array_push($conditionalStyles, $condition0); |
|
62 | - array_push($conditionalStyles, $condition1); |
|
63 | - array_push($conditionalStyles, $condition2); |
|
64 | - $spreadsheet->getActiveSheet()->setConditionalStyles($pCoordinate, $conditionalStyles); |
|
59 | + // put all three conditions in sheet |
|
60 | + $conditionalStyles = []; |
|
61 | + array_push($conditionalStyles, $condition0); |
|
62 | + array_push($conditionalStyles, $condition1); |
|
63 | + array_push($conditionalStyles, $condition2); |
|
64 | + $spreadsheet->getActiveSheet()->setConditionalStyles($pCoordinate, $conditionalStyles); |
|
65 | 65 | |
66 | 66 | $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format); |
67 | 67 | |
68 | - // see if we successfully written "StopIfTrue" |
|
69 | - $newConditionalStyles = $reloadedSpreadsheet->getActiveSheet()->getConditionalStyles($pCoordinate); |
|
70 | - self::assertTrue($newConditionalStyles[0]->getStopIfTrue(), 'StopIfTrue should be set (=true) on first condition'); |
|
71 | - self::assertFalse($newConditionalStyles[1]->getStopIfTrue(), 'StopIfTrue should not be set (=false) on second condition'); |
|
72 | - self::assertFalse($newConditionalStyles[2]->getStopIfTrue(), 'StopIfTrue should not be set (=false) on third condition'); |
|
68 | + // see if we successfully written "StopIfTrue" |
|
69 | + $newConditionalStyles = $reloadedSpreadsheet->getActiveSheet()->getConditionalStyles($pCoordinate); |
|
70 | + self::assertTrue($newConditionalStyles[0]->getStopIfTrue(), 'StopIfTrue should be set (=true) on first condition'); |
|
71 | + self::assertFalse($newConditionalStyles[1]->getStopIfTrue(), 'StopIfTrue should not be set (=false) on second condition'); |
|
72 | + self::assertFalse($newConditionalStyles[2]->getStopIfTrue(), 'StopIfTrue should not be set (=false) on third condition'); |
|
73 | 73 | } |
74 | 74 | } |