Skip to content

Commit 3767917

Browse files
author
MarkBaker
committed
Stubs for reading style information for Conditional Formatting
1 parent 45c08d6 commit 3767917

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

src/PhpSpreadsheet/Reader/Xls.php

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7998,6 +7998,9 @@ private function readCFRule(array $cellRangeAddresses): void
79987998
// offset: 6; size: 4; Options
79997999
$options = self::getInt4d($recordData, 6);
80008000

8001+
$style = new Style();
8002+
$this->getCFStyleOptions($options, $style);
8003+
80018004
$hasFontRecord = (bool) ((0x04000000 & $options) >> 26);
80028005
$hasAlignmentRecord = (bool) ((0x08000000 & $options) >> 27);
80038006
$hasBorderRecord = (bool) ((0x10000000 & $options) >> 28);
@@ -8007,22 +8010,32 @@ private function readCFRule(array $cellRangeAddresses): void
80078010
$offset = 12;
80088011

80098012
if ($hasFontRecord === true) {
8013+
$fontStyle = substr($recordData, $offset, 118);
8014+
$this->getCFFontStyle($fontStyle, $style);
80108015
$offset += 118;
80118016
}
80128017

80138018
if ($hasAlignmentRecord === true) {
8019+
$alignmentStyle = substr($recordData, $offset, 8);
8020+
$this->getCFAlignmentStyle($alignmentStyle, $style);
80148021
$offset += 8;
80158022
}
80168023

80178024
if ($hasBorderRecord === true) {
8025+
$borderStyle = substr($recordData, $offset, 8);
8026+
$this->getCFBorderStyle($borderStyle, $style);
80188027
$offset += 8;
80198028
}
80208029

80218030
if ($hasFillRecord === true) {
8031+
$fillStyle = substr($recordData, $offset, 4);
8032+
$this->getCFFillStyle($fillStyle, $style);
80228033
$offset += 4;
80238034
}
80248035

80258036
if ($hasProtectionRecord === true) {
8037+
$protectionStyle = substr($recordData, $offset, 4);
8038+
$this->getCFProtectionStyle($protectionStyle, $style);
80268039
$offset += 2;
80278040
}
80288041

@@ -8049,7 +8062,31 @@ private function readCFRule(array $cellRangeAddresses): void
80498062
$offset += $size2;
80508063
}
80518064

8052-
$this->setCFRules($cellRangeAddresses, $type, $operator, $formula1, $formula2);
8065+
$this->setCFRules($cellRangeAddresses, $type, $operator, $formula1, $formula2, $style);
8066+
}
8067+
8068+
private function getCFStyleOptions(int $options, Style $style): void
8069+
{
8070+
}
8071+
8072+
private function getCFFontStyle(string $options, Style $style): void
8073+
{
8074+
}
8075+
8076+
private function getCFAlignmentStyle(string $options, Style $style): void
8077+
{
8078+
}
8079+
8080+
private function getCFBorderStyle(string $options, Style $style): void
8081+
{
8082+
}
8083+
8084+
private function getCFFillStyle(string $options, Style $style): void
8085+
{
8086+
}
8087+
8088+
private function getCFProtectionStyle(string $options, Style $style): void
8089+
{
80538090
}
80548091

80558092
/**
@@ -8077,7 +8114,7 @@ private function readCFFormula(string $recordData, int $offset, int $size)
80778114
* @param null|float|int|string $formula1
80788115
* @param null|float|int|string $formula2
80798116
*/
8080-
private function setCFRules(array $cellRanges, string $type, string $operator, $formula1, $formula2): void
8117+
private function setCFRules(array $cellRanges, string $type, string $operator, $formula1, $formula2, Style $style): void
80818118
{
80828119
foreach ($cellRanges as $cellRange) {
80838120
$conditional = new Conditional();
@@ -8089,6 +8126,7 @@ private function setCFRules(array $cellRanges, string $type, string $operator, $
80898126
if ($formula2 !== null) {
80908127
$conditional->addCondition($formula2);
80918128
}
8129+
$conditional->setStyle($style);
80928130

80938131
$conditionalStyles = $this->phpSheet->getStyle($cellRange)->getConditionalStyles();
80948132
$conditionalStyles[] = $conditional;

0 commit comments

Comments
 (0)