Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support DataBar of conditional formatting rule
Implemented the databar of Conditional Type. - DataBar can be read, written, and added for basic use. - Supports reading, writing and adding using "extLst". About "extLst" - https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/07d607af-5618-4ca2-b683-6a78dc0d9627 The following setting items on the Excel setting screen can be read, written, and added. - (minimum, maximum)type: Automatic, LowestValue, Number, Percent, Formula, Percentile - Direction: context, leftToRight, rightToLeft (show data bar only) - Fills Solid, Gradient - FillColor: PositiveValues, NegativeValues - Borders: Solid, None - BorderColor: PositiveValues, NegativeValues - Axis position: Automatic, Midpoint, None - Axis color
- Loading branch information
Showing
9 changed files
with
1,189 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBar.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?php | ||
|
||
namespace PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting; | ||
|
||
use PhpOffice\PhpSpreadsheet\Style\Color; | ||
|
||
class ConditionalDataBar | ||
{ | ||
/** <dataBar> attribute */ | ||
private $showValue; | ||
|
||
/** <dataBar> children */ | ||
|
||
/** @var ConditionalFormatValueObject[] */ | ||
private $conditionalFormatValueObjects = []; | ||
|
||
/** @var Color */ | ||
private $color; | ||
|
||
/** @var ConditionalFormattingRuleExtension[] */ | ||
private $conditionalFormattingRuleExtList = []; | ||
|
||
/** | ||
* @return null|string | ||
*/ | ||
public function getShowValue() | ||
{ | ||
return $this->showValue; | ||
} | ||
|
||
/** | ||
* @param int $showValue | ||
*/ | ||
public function setShowValue($showValue) | ||
{ | ||
$this->showValue = $showValue; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return ConditionalFormatValueObject[] | ||
*/ | ||
public function getConditionalFormatValueObjects(): array | ||
{ | ||
return $this->conditionalFormatValueObjects; | ||
} | ||
|
||
/** | ||
* @param ConditionalFormatValueObject[] $conditionalFormatValueObjects | ||
*/ | ||
public function setConditionalFormatValueObjects(array $conditionalFormatValueObjects) | ||
{ | ||
$this->conditionalFormatValueObjects = $conditionalFormatValueObjects; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param mixed $type | ||
* @param null|mixed $value | ||
* @param null|mixed $cellFomula | ||
* | ||
* @return $this | ||
*/ | ||
public function addConditionalFormatValueObject($type, $value = null, $cellFomula = null): self | ||
{ | ||
$this->conditionalFormatValueObjects[] = new ConditionalFormatValueObject($type, $value, $cellFomula); | ||
|
||
return $this; | ||
} | ||
|
||
public function getColor(): Color | ||
{ | ||
return $this->color; | ||
} | ||
|
||
public function setColor(Color $color): self | ||
{ | ||
$this->color = $color; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return ConditionalFormattingRuleExtension[] | ||
*/ | ||
public function getConditionalFormattingRuleExtList(): array | ||
{ | ||
return $this->conditionalFormattingRuleExtList; | ||
} | ||
|
||
/** | ||
* @param ConditionalFormattingRuleExtension[] $conditionalFormattingRuleExtList | ||
*/ | ||
public function setConditionalFormattingRuleExtList(array $conditionalFormattingRuleExtList): self | ||
{ | ||
$this->conditionalFormattingRuleExtList = $conditionalFormattingRuleExtList; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return $this | ||
*/ | ||
public function addConditionalFormattingRuleExtList(ConditionalFormattingRuleExtension $conditionalFormattingRuleExt): self | ||
{ | ||
$this->conditionalFormattingRuleExtList[] = $conditionalFormattingRuleExt; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.