Skip to content

Commit dd981a3

Browse files
author
Mark Baker
authored
Merge branch 'master' into CSV-Reader-Dataype-casting-improvements
2 parents aad91f1 + 23631cb commit dd981a3

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

docs/topics/conditional-formatting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $conditional->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERA
4343
$conditional->addCondition(80);
4444
$conditional->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN);
4545
$conditional->getStyle()->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID);
46-
$conditional->getStyle()->getFill()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
46+
$conditional->getStyle()->getFill()->getStartColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
4747

4848
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1:A10')->getConditionalStyles();
4949
$conditionalStyles[] = $conditional;
@@ -63,7 +63,7 @@ $wizard = $wizardFactory->newRule(\PhpOffice\PhpSpreadsheet\Style\ConditionalFor
6363
$wizard->greaterThan(80);
6464
$wizard->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN);
6565
$wizard->getStyle()->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID);
66-
$wizard->getStyle()->getFill()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
66+
$wizard->getStyle()->getFill()->getStartColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
6767

6868
$conditional = $wizard->getConditional();
6969
```
@@ -84,7 +84,7 @@ $conditional2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPER
8484
$conditional2->addCondition(10);
8585
$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKRED);
8686
$conditional2->getStyle()->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID);
87-
$conditional2->getStyle()->getFill()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
87+
$conditional2->getStyle()->getFill()->getStartColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
8888

8989
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1:A10')->getConditionalStyles();
9090
$conditionalStyles[] = $conditional2;
@@ -98,7 +98,7 @@ $wizard = $wizardFactory->newRule(\PhpOffice\PhpSpreadsheet\Style\ConditionalFor
9898
$wizard->lessThan(10);
9999
$wizard->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN);
100100
$wizard->getStyle()->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID);
101-
$wizard->getStyle()->getFill()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
101+
$wizard->getStyle()->getFill()->getStartColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
102102

103103
$conditional = $wizard->getConditional();
104104
```

src/PhpSpreadsheet/Reader/Xls.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,8 @@ protected function loadSpreadsheetFromFile(string $filename): Spreadsheet
11011101
$height = SharedXls::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY);
11021102

11031103
// calculate offsetX and offsetY of the shape
1104-
$offsetX = $startOffsetX * SharedXls::sizeCol($this->phpSheet, $startColumn) / 1024;
1105-
$offsetY = $startOffsetY * SharedXls::sizeRow($this->phpSheet, $startRow) / 256;
1104+
$offsetX = (int) ($startOffsetX * SharedXls::sizeCol($this->phpSheet, $startColumn) / 1024);
1105+
$offsetY = (int) ($startOffsetY * SharedXls::sizeRow($this->phpSheet, $startRow) / 256);
11061106

11071107
switch ($obj['otObjType']) {
11081108
case 0x19:

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ public function testImCscArray(array $expectedResult, string $complex): void
5252

5353
$formula = "=IMCSC({$complex})";
5454
$result = $calculation->_calculateFormulaValue($formula);
55+
// Avoid testing for excess precision
56+
foreach ($expectedResult as &$array) {
57+
foreach ($array as &$string) {
58+
$string = preg_replace('/(\\d{8})\\d+/', '$1', $string);
59+
}
60+
}
61+
foreach ($result as &$array) {
62+
foreach ($array as &$string) {
63+
$string = preg_replace('/(\\d{8})\\d+/', '$1', $string);
64+
}
65+
}
66+
5567
self::assertEquals($expectedResult, $result);
5668
}
5769

0 commit comments

Comments
 (0)