Skip to content

Commit aea156f

Browse files
author
MarkBaker
committed
Minor tweaks
1 parent 3803658 commit aea156f

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/PhpSpreadsheet/Reader/Xls.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7937,7 +7937,6 @@ public function getMapCellStyleXfIndex(): array
79377937

79387938
private function readCFHeader(): array
79397939
{
7940-
// var_dump('FOUND CF HEADER');
79417940
$length = self::getUInt2d($this->data, $this->pos + 2);
79427941
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
79437942

@@ -7949,22 +7948,19 @@ private function readCFHeader(): array
79497948
}
79507949

79517950
// offset: 0; size: 2; Rule Count
7952-
$ruleCount = self::getUInt2d($recordData, 0);
7951+
// $ruleCount = self::getUInt2d($recordData, 0);
79537952

79547953
// offset: var; size: var; cell range address list with
79557954
$cellRangeAddressList = ($this->version == self::XLS_BIFF8)
79567955
? $this->readBIFF8CellRangeAddressList(substr($recordData, 12))
79577956
: $this->readBIFF5CellRangeAddressList(substr($recordData, 12));
79587957
$cellRangeAddresses = $cellRangeAddressList['cellRangeAddresses'];
79597958

7960-
// var_dump($ruleCount, $cellRangeAddresses);
7961-
//
79627959
return $cellRangeAddresses;
79637960
}
79647961

79657962
private function readCFRule(array $cellRangeAddresses): void
79667963
{
7967-
// var_dump('FOUND CF RULE');
79687964
$length = self::getUInt2d($this->data, $this->pos + 2);
79697965
$recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
79707966

@@ -8040,15 +8036,12 @@ private function readCFRule(array $cellRangeAddresses): void
80408036
$offset += 2;
80418037
}
80428038

8043-
// var_dump($type, $operator);
8044-
//
80458039
$formula1 = $formula2 = null;
80468040
if ($size1 > 0) {
80478041
$formula1 = $this->readCFFormula($recordData, $offset, $size1);
80488042
if ($formula1 === null) {
80498043
return;
80508044
}
8051-
// var_dump($formula1);
80528045

80538046
$offset += $size1;
80548047
}
@@ -8058,7 +8051,6 @@ private function readCFRule(array $cellRangeAddresses): void
80588051
if ($formula2 === null) {
80598052
return;
80608053
}
8061-
// var_dump($formula2);
80628054

80638055
$offset += $size2;
80648056
}
@@ -8073,20 +8065,19 @@ private function getCFStyleOptions(int $options, Style $style): void
80738065
private function getCFFontStyle(string $options, Style $style): void
80748066
{
80758067
$fontSize = self::getInt4d($options, 64);
8076-
$fontSize = ($fontSize !== -1) ? $fontSize / 20 : -1;
8068+
if ($fontSize !== -1) {
8069+
$style->getFont()->setSize($fontSize / 20); // Convert twips to points
8070+
}
8071+
8072+
80778073
$bold = self::getUInt2d($options, 72) === 700; // 400 = normal, 700 = bold
8074+
$style->getFont()->setBold($bold);
8075+
80788076
$color = self::getInt4d($options, 80);
80798077

8080-
if ($fontSize !== -1) {
8081-
$style->getFont()->setSize($fontSize);
8082-
}
80838078
if ($color !== -1) {
8084-
$style->getFont()->setColor(
8085-
new \PhpOffice\PhpSpreadsheet\Style\Color(Color::map($color, $this->palette, $this->version)['rgb'])
8086-
);
8079+
$style->getFont()->getColor()->setRGB(Color::map($color, $this->palette, $this->version)['rgb']);
80878080
}
8088-
$style->getFont()
8089-
->setBold($bold);
80908081
}
80918082

80928083
private function getCFAlignmentStyle(string $options, Style $style): void

0 commit comments

Comments
 (0)