Standardize keys used for styling

Array keys used for styling have been standardized for a more coherent experience.
It now uses the same wording and casing as the getter and setter methods.

Closes #189
This commit is contained in:
Adrien Crivelli 2017-09-09 02:56:23 +09:00
parent e6c95bf9b0
commit 1c5db4e170
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
29 changed files with 329 additions and 255 deletions

View File

@ -1,4 +1,5 @@
# Changelog # Changelog
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
@ -16,6 +17,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
### BREAKING CHANGE
- Standardization of array keys used for style, see the [migration guide](./docs/topics/migration-from-PHPExcel.md).
## [1.0.0-beta] - 2017-08-17 ## [1.0.0-beta] - 2017-08-17
@ -50,7 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Introduction of namespaces for all classes, eg: `PHPExcel_Calculation_Functions` becomes `PhpOffice\PhpSpreadsheet\Calculation\Functions` - Introduction of namespaces for all classes, eg: `PHPExcel_Calculation_Functions` becomes `PhpOffice\PhpSpreadsheet\Calculation\Functions`
- Some classes were renamed for clarity and/or consistency: - Some classes were renamed for clarity and/or consistency:
For a comprehensive list of all class changes, and a semi-automated migration path, read the [migration guide](./docs/Migration-from-PHPExcel.md). For a comprehensive list of all class changes, and a semi-automated migration path, read the [migration guide](./docs/topics/migration-from-PHPExcel.md).
- Dropped `PHPExcel_Calculation_Functions::VERSION()`. Composer or git should be used to know the version. - Dropped `PHPExcel_Calculation_Functions::VERSION()`. Composer or git should be used to know the version.
- Dropped `PHPExcel_Settings::setPdfRenderer()` and `PHPExcel_Settings::setPdfRenderer()`. Composer should be used to autoload PDF libs. - Dropped `PHPExcel_Settings::setPdfRenderer()` and `PHPExcel_Settings::setPdfRenderer()`. Composer should be used to autoload PDF libs.

View File

@ -192,3 +192,74 @@ $cell = $worksheet->setCellValue('A1', 'value', true);
// After // After
$cell = $worksheet->getCell('A1')->setValue('value'); $cell = $worksheet->getCell('A1')->setValue('value');
``` ```
## Standardized keys for styling
Array keys used for styling have been standardized for a more coherent experience.
It now uses the same wording and casing as the getter and setter:
```php
// Before
$style = [
'numberformat' => [
'code' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
],
'font' => [
'strike' => true,
'superScript' => true,
'subScript' => true,
],
'alignment' => [
'rotation' => 90,
'readorder' => Alignment::READORDER_RTL,
'wrap' => true,
],
'borders' => [
'diagonaldirection' => Borders::DIAGONAL_BOTH,
'allborders' => [
'style' => Border::BORDER_THIN,
],
],
'fill' => [
'type' => Fill::FILL_GRADIENT_LINEAR,
'startcolor' => [
'argb' => 'FFA0A0A0',
],
'endcolor' => [
'argb' => 'FFFFFFFF',
],
],
];
// After
$style = [
'numberFormat' => [
'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
],
'font' => [
'strikethrough' => true,
'superscript' => true,
'subscript' => true,
],
'alignment' => [
'textRotation' => 90,
'readOrder' => Alignment::READORDER_RTL,
'wrapText' => true,
],
'borders' => [
'diagonalDirection' => Borders::DIAGONAL_BOTH,
'allBorders' => [
'borderStyle' => Border::BORDER_THIN,
],
],
'fill' => [
'fillType' => Fill::FILL_GRADIENT_LINEAR,
'startColor' => [
'argb' => 'FFA0A0A0',
],
'endColor' => [
'argb' => 'FFFFFFFF',
],
],
];
```

View File

@ -558,16 +558,16 @@ $styleArray = array(
), ),
'borders' => array( 'borders' => array(
'top' => array( 'top' => array(
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
), ),
), ),
'fill' => array( 'fill' => array(
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR, 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90, 'rotation' => 90,
'startcolor' => array( 'startColor' => array(
'argb' => 'FFA0A0A0', 'argb' => 'FFA0A0A0',
), ),
'endcolor' => array( 'endColor' => array(
'argb' => 'FFFFFFFF', 'argb' => 'FFFFFFFF',
), ),
), ),
@ -693,7 +693,7 @@ B2:G8.
$styleArray = array( $styleArray = array(
'borders' => array( 'borders' => array(
'outline' => array( 'outline' => array(
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK, 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => array('argb' => 'FFFF0000'), 'color' => array('argb' => 'FFFF0000'),
), ),
), ),
@ -721,7 +721,7 @@ operating on a single cell at a time:
Additional shortcut borders come in handy like in the example above. Additional shortcut borders come in handy like in the example above.
These are the shortcut borders available: These are the shortcut borders available:
- allborders - allBorders
- outline - outline
- inside - inside
- vertical - vertical
@ -731,10 +731,10 @@ An overview of all border shortcuts can be seen in the following image:
![08-styling-border-options.png](./images/08-styling-border-options.png) ![08-styling-border-options.png](./images/08-styling-border-options.png)
If you simultaneously set e.g. allborders and vertical, then we have If you simultaneously set e.g. allBorders and vertical, then we have
"overlapping" borders, and one of the components has to win over the "overlapping" borders, and one of the components has to win over the
other where there is border overlap. In PhpSpreadsheet, from weakest to other where there is border overlap. In PhpSpreadsheet, from weakest to
strongest borders, the list is as follows: allborders, outline/inside, strongest borders, the list is as follows: allBorders, outline/inside,
vertical/horizontal, left/right/top/bottom/diagonal. vertical/horizontal, left/right/top/bottom/diagonal.
This border hierarchy can be utilized to achieve various effects in an This border hierarchy can be utilized to achieve various effects in an
@ -757,17 +757,17 @@ fill | getFill()
font | getFont() font | getFont()
borders | getBorders() borders | getBorders()
alignment | getAlignment() alignment | getAlignment()
numberformat | getNumberFormat() numberFormat | getNumberFormat()
protection | getProtection() protection | getProtection()
**\PhpOffice\PhpSpreadsheet\Style\Fill** **\PhpOffice\PhpSpreadsheet\Style\Fill**
Array key | Maps to property Array key | Maps to property
-----------|------------------- -----------|-------------------
type | setFillType() fillType | setFillType()
rotation | setRotation() rotation | setRotation()
startcolor | getStartColor() startColor | getStartColor()
endcolor | getEndColor() endColor | getEndColor()
color | getStartColor() color | getStartColor()
@ -779,17 +779,17 @@ name | setName()
bold | setBold() bold | setBold()
italic | setItalic() italic | setItalic()
underline | setUnderline() underline | setUnderline()
strike | setStrikethrough() strikethrough | setStrikethrough()
color | getColor() color | getColor()
size | setSize() size | setSize()
superScript | setSuperScript() superscript | setSuperscript()
subScript | setSubScript() subscript | setSubscript()
**\PhpOffice\PhpSpreadsheet\Style\Borders** **\PhpOffice\PhpSpreadsheet\Style\Borders**
Array key | Maps to property Array key | Maps to property
------------------|------------------- ------------------|-------------------
allborders | getLeft(); getRight(); getTop(); getBottom() allBorders | getLeft(); getRight(); getTop(); getBottom()
left | getLeft() left | getLeft()
right | getRight() right | getRight()
top | getTop() top | getTop()
@ -797,7 +797,7 @@ bottom | getBottom()
diagonal | getDiagonal() diagonal | getDiagonal()
vertical | getVertical() vertical | getVertical()
horizontal | getHorizontal() horizontal | getHorizontal()
diagonaldirection | setDiagonalDirection() diagonalDirection | setDiagonalDirection()
outline | setOutline() outline | setOutline()
**\PhpOffice\PhpSpreadsheet\Style\Border** **\PhpOffice\PhpSpreadsheet\Style\Border**
@ -813,8 +813,8 @@ Array key | Maps to property
------------|------------------- ------------|-------------------
horizontal | setHorizontal() horizontal | setHorizontal()
vertical | setVertical() vertical | setVertical()
rotation | setTextRotation() textRotation| setTextRotation()
wrap | setWrapText() wrapText | setWrapText()
shrinkToFit | setShrinkToFit() shrinkToFit | setShrinkToFit()
indent | setIndent() indent | setIndent()
@ -822,7 +822,7 @@ indent | setIndent()
Array key | Maps to property Array key | Maps to property
----------|------------------- ----------|-------------------
code | setFormatCode() formatCode | setFormatCode()
**\PhpOffice\PhpSpreadsheet\Style\Protection** **\PhpOffice\PhpSpreadsheet\Style\Protection**

View File

@ -26,19 +26,19 @@ $spreadsheet->setActiveSheetIndex(0);
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray( $spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
['fill' => [ ['fill' => [
'type' => Fill::FILL_SOLID, 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'], 'color' => ['argb' => 'FFCCFFCC'],
], ],
'borders' => [ 'borders' => [
'bottom' => ['style' => Border::BORDER_THIN], 'bottom' => ['borderStyle' => Border::BORDER_THIN],
'right' => ['style' => Border::BORDER_MEDIUM], 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
], ],
] ]
); );
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray( $spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
['fill' => [ ['fill' => [
'type' => Fill::FILL_SOLID, 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'], 'color' => ['argb' => 'FFFFFF00'],
], ],
] ]

View File

@ -30,24 +30,24 @@ $sharedStyle2 = new Style();
$sharedStyle1->applyFromArray( $sharedStyle1->applyFromArray(
['fill' => [ ['fill' => [
'type' => Fill::FILL_SOLID, 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'], 'color' => ['argb' => 'FFCCFFCC'],
], ],
'borders' => [ 'borders' => [
'bottom' => ['style' => Border::BORDER_THIN], 'bottom' => ['borderStyle' => Border::BORDER_THIN],
'right' => ['style' => Border::BORDER_MEDIUM], 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
], ],
] ]
); );
$sharedStyle2->applyFromArray( $sharedStyle2->applyFromArray(
['fill' => [ ['fill' => [
'type' => Fill::FILL_SOLID, 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'], 'color' => ['argb' => 'FFFFFF00'],
], ],
'borders' => [ 'borders' => [
'bottom' => ['style' => Border::BORDER_THIN], 'bottom' => ['borderStyle' => Border::BORDER_THIN],
'right' => ['style' => Border::BORDER_MEDIUM], 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
], ],
] ]
); );

View File

@ -156,7 +156,7 @@ $helper->log('Set thin black border outline around column');
$styleThinBlackBorderOutline = [ $styleThinBlackBorderOutline = [
'borders' => [ 'borders' => [
'outline' => [ 'outline' => [
'style' => Border::BORDER_THIN, 'borderStyle' => Border::BORDER_THIN,
'color' => ['argb' => 'FF000000'], 'color' => ['argb' => 'FF000000'],
], ],
], ],
@ -168,7 +168,7 @@ $helper->log('Set thick brown border outline around Total');
$styleThickBrownBorderOutline = [ $styleThickBrownBorderOutline = [
'borders' => [ 'borders' => [
'outline' => [ 'outline' => [
'style' => Border::BORDER_THICK, 'borderStyle' => Border::BORDER_THICK,
'color' => ['argb' => 'FF993300'], 'color' => ['argb' => 'FF993300'],
], ],
], ],
@ -192,16 +192,16 @@ $spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
], ],
'borders' => [ 'borders' => [
'top' => [ 'top' => [
'style' => Border::BORDER_THIN, 'borderStyle' => Border::BORDER_THIN,
], ],
], ],
'fill' => [ 'fill' => [
'type' => Fill::FILL_GRADIENT_LINEAR, 'fillType' => Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90, 'rotation' => 90,
'startcolor' => [ 'startColor' => [
'argb' => 'FFA0A0A0', 'argb' => 'FFA0A0A0',
], ],
'endcolor' => [ 'endColor' => [
'argb' => 'FFFFFFFF', 'argb' => 'FFFFFFFF',
], ],
], ],
@ -215,7 +215,7 @@ $spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray(
], ],
'borders' => [ 'borders' => [
'left' => [ 'left' => [
'style' => Border::BORDER_THIN, 'borderStyle' => Border::BORDER_THIN,
], ],
], ],
] ]
@ -233,7 +233,7 @@ $spreadsheet->getActiveSheet()->getStyle('E3')->applyFromArray(
[ [
'borders' => [ 'borders' => [
'right' => [ 'right' => [
'style' => Border::BORDER_THIN, 'borderStyle' => Border::BORDER_THIN,
], ],
], ],
] ]

View File

@ -678,10 +678,10 @@ class Html
$richtextRun->getFont()->setUnderline(Font::UNDERLINE_SINGLE); $richtextRun->getFont()->setUnderline(Font::UNDERLINE_SINGLE);
} }
if ($this->superscript) { if ($this->superscript) {
$richtextRun->getFont()->setSuperScript(true); $richtextRun->getFont()->setSuperscript(true);
} }
if ($this->subscript) { if ($this->subscript) {
$richtextRun->getFont()->setSubScript(true); $richtextRun->getFont()->setSubscript(true);
} }
if ($this->strikethrough) { if ($this->strikethrough) {
$richtextRun->getFont()->setStrikethrough(true); $richtextRun->getFont()->setStrikethrough(true);

View File

@ -486,7 +486,7 @@ class Gnumeric extends BaseReader implements IReader
if ((!$this->readDataOnly) || if ((!$this->readDataOnly) ||
(Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) { (Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
$styleArray = []; $styleArray = [];
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format']; $styleArray['numberFormat']['formatCode'] = (string) $styleAttributes['Format'];
// If readDataOnly is false, we set all formatting information // If readDataOnly is false, we set all formatting information
if (!$this->readDataOnly) { if (!$this->readDataOnly) {
switch ($styleAttributes['HAlign']) { switch ($styleAttributes['HAlign']) {
@ -526,7 +526,7 @@ class Gnumeric extends BaseReader implements IReader
break; break;
} }
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false; $styleArray['alignment']['wrapText'] = ($styleAttributes['WrapText'] == '1') ? true : false;
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false; $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
$styleArray['alignment']['indent'] = ((int) ($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0; $styleArray['alignment']['indent'] = ((int) ($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0;
@ -535,69 +535,69 @@ class Gnumeric extends BaseReader implements IReader
$RGB = self::parseGnumericColour($styleAttributes['Back']); $RGB = self::parseGnumericColour($styleAttributes['Back']);
$shade = $styleAttributes['Shade']; $shade = $styleAttributes['Shade'];
if (($RGB != '000000') || ($shade != '0')) { if (($RGB != '000000') || ($shade != '0')) {
$styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB; $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startColor']['rgb'] = $RGB;
$RGB2 = self::parseGnumericColour($styleAttributes['PatternColor']); $RGB2 = self::parseGnumericColour($styleAttributes['PatternColor']);
$styleArray['fill']['endcolor']['rgb'] = $RGB2; $styleArray['fill']['endColor']['rgb'] = $RGB2;
switch ($shade) { switch ($shade) {
case '1': case '1':
$styleArray['fill']['type'] = Fill::FILL_SOLID; $styleArray['fill']['fillType'] = Fill::FILL_SOLID;
break; break;
case '2': case '2':
$styleArray['fill']['type'] = Fill::FILL_GRADIENT_LINEAR; $styleArray['fill']['fillType'] = Fill::FILL_GRADIENT_LINEAR;
break; break;
case '3': case '3':
$styleArray['fill']['type'] = Fill::FILL_GRADIENT_PATH; $styleArray['fill']['fillType'] = Fill::FILL_GRADIENT_PATH;
break; break;
case '4': case '4':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKDOWN; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKDOWN;
break; break;
case '5': case '5':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKGRAY; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKGRAY;
break; break;
case '6': case '6':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKGRID; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKGRID;
break; break;
case '7': case '7':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKHORIZONTAL; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKHORIZONTAL;
break; break;
case '8': case '8':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKTRELLIS; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKTRELLIS;
break; break;
case '9': case '9':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKUP; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKUP;
break; break;
case '10': case '10':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_DARKVERTICAL; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKVERTICAL;
break; break;
case '11': case '11':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_GRAY0625; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_GRAY0625;
break; break;
case '12': case '12':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_GRAY125; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_GRAY125;
break; break;
case '13': case '13':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTDOWN; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTDOWN;
break; break;
case '14': case '14':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTGRAY; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTGRAY;
break; break;
case '15': case '15':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTGRID; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTGRID;
break; break;
case '16': case '16':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTHORIZONTAL; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTHORIZONTAL;
break; break;
case '17': case '17':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTTRELLIS; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTTRELLIS;
break; break;
case '18': case '18':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTUP; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTUP;
break; break;
case '19': case '19':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_LIGHTVERTICAL; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTVERTICAL;
break; break;
case '20': case '20':
$styleArray['fill']['type'] = Fill::FILL_PATTERN_MEDIUMGRAY; $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_MEDIUMGRAY;
break; break;
} }
} }
@ -607,7 +607,7 @@ class Gnumeric extends BaseReader implements IReader
$styleArray['font']['size'] = (int) ($fontAttributes['Unit']); $styleArray['font']['size'] = (int) ($fontAttributes['Unit']);
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false; $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false; $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false; $styleArray['font']['strikethrough'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
switch ($fontAttributes['Underline']) { switch ($fontAttributes['Underline']) {
case '1': case '1':
$styleArray['font']['underline'] = Font::UNDERLINE_SINGLE; $styleArray['font']['underline'] = Font::UNDERLINE_SINGLE;
@ -627,10 +627,10 @@ class Gnumeric extends BaseReader implements IReader
} }
switch ($fontAttributes['Script']) { switch ($fontAttributes['Script']) {
case '1': case '1':
$styleArray['font']['superScript'] = true; $styleArray['font']['superscript'] = true;
break; break;
case '-1': case '-1':
$styleArray['font']['subScript'] = true; $styleArray['font']['subscript'] = true;
break; break;
} }
@ -649,13 +649,13 @@ class Gnumeric extends BaseReader implements IReader
} }
if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) { if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) {
$styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
$styleArray['borders']['diagonaldirection'] = Borders::DIAGONAL_BOTH; $styleArray['borders']['diagonalDirection'] = Borders::DIAGONAL_BOTH;
} elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) { } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) {
$styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
$styleArray['borders']['diagonaldirection'] = Borders::DIAGONAL_UP; $styleArray['borders']['diagonalDirection'] = Borders::DIAGONAL_UP;
} elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) { } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) {
$styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes()); $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes());
$styleArray['borders']['diagonaldirection'] = Borders::DIAGONAL_DOWN; $styleArray['borders']['diagonalDirection'] = Borders::DIAGONAL_DOWN;
} }
} }
if (isset($styleRegion->Style->HyperLink)) { if (isset($styleRegion->Style->HyperLink)) {
@ -770,46 +770,46 @@ class Gnumeric extends BaseReader implements IReader
switch ($borderAttributes['Style']) { switch ($borderAttributes['Style']) {
case '0': case '0':
$styleArray['style'] = Border::BORDER_NONE; $styleArray['borderStyle'] = Border::BORDER_NONE;
break; break;
case '1': case '1':
$styleArray['style'] = Border::BORDER_THIN; $styleArray['borderStyle'] = Border::BORDER_THIN;
break; break;
case '2': case '2':
$styleArray['style'] = Border::BORDER_MEDIUM; $styleArray['borderStyle'] = Border::BORDER_MEDIUM;
break; break;
case '3': case '3':
$styleArray['style'] = Border::BORDER_SLANTDASHDOT; $styleArray['borderStyle'] = Border::BORDER_SLANTDASHDOT;
break; break;
case '4': case '4':
$styleArray['style'] = Border::BORDER_DASHED; $styleArray['borderStyle'] = Border::BORDER_DASHED;
break; break;
case '5': case '5':
$styleArray['style'] = Border::BORDER_THICK; $styleArray['borderStyle'] = Border::BORDER_THICK;
break; break;
case '6': case '6':
$styleArray['style'] = Border::BORDER_DOUBLE; $styleArray['borderStyle'] = Border::BORDER_DOUBLE;
break; break;
case '7': case '7':
$styleArray['style'] = Border::BORDER_DOTTED; $styleArray['borderStyle'] = Border::BORDER_DOTTED;
break; break;
case '8': case '8':
$styleArray['style'] = Border::BORDER_MEDIUMDASHED; $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHED;
break; break;
case '9': case '9':
$styleArray['style'] = Border::BORDER_DASHDOT; $styleArray['borderStyle'] = Border::BORDER_DASHDOT;
break; break;
case '10': case '10':
$styleArray['style'] = Border::BORDER_MEDIUMDASHDOT; $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHDOT;
break; break;
case '11': case '11':
$styleArray['style'] = Border::BORDER_DASHDOTDOT; $styleArray['borderStyle'] = Border::BORDER_DASHDOTDOT;
break; break;
case '12': case '12':
$styleArray['style'] = Border::BORDER_MEDIUMDASHDOTDOT; $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHDOTDOT;
break; break;
case '13': case '13':
$styleArray['style'] = Border::BORDER_MEDIUMDASHDOTDOT; $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHDOTDOT;
break; break;
} }

View File

@ -110,7 +110,7 @@ class Html extends BaseReader implements IReader
'hr' => [ 'hr' => [
'borders' => [ 'borders' => [
'bottom' => [ 'bottom' => [
'style' => Border::BORDER_THIN, 'borderStyle' => Border::BORDER_THIN,
'color' => [ 'color' => [
Color::COLOR_BLACK, Color::COLOR_BLACK,
], ],
@ -482,7 +482,7 @@ class Html extends BaseReader implements IReader
$sheet->getStyle($column . $row)->applyFromArray( $sheet->getStyle($column . $row)->applyFromArray(
[ [
'fill' => [ 'fill' => [
'type' => Fill::FILL_SOLID, 'fillType' => Fill::FILL_SOLID,
'color' => ['rgb' => $attributeArray['bgcolor']], 'color' => ['rgb' => $attributeArray['bgcolor']],
], ],
] ]
@ -631,7 +631,7 @@ class Html extends BaseReader implements IReader
switch (trim($value[0])) { switch (trim($value[0])) {
case 'background-color': case 'background-color':
$sheet->getStyle($column . $row)->applyFromArray(['fill' => ['type' => Fill::FILL_SOLID, 'color' => ['rgb' => "{$style_color}"]]]); $sheet->getStyle($column . $row)->applyFromArray(['fill' => ['fillType' => Fill::FILL_SOLID, 'color' => ['rgb' => "{$style_color}"]]]);
break; break;
case 'color': case 'color':
$sheet->getStyle($column . $row)->applyFromArray(['font' => ['color' => ['rgb' => "$style_color}"]]]); $sheet->getStyle($column . $row)->applyFromArray(['font' => ['color' => ['rgb' => "$style_color}"]]]);

View File

@ -260,7 +260,7 @@ class Slk extends BaseReader implements IReader
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum[0]) { switch ($rowDatum[0]) {
case 'P': case 'P':
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1)); $formatArray['numberFormat']['formatCode'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
break; break;
case 'E': case 'E':
case 'F': case 'F':
@ -280,16 +280,16 @@ class Slk extends BaseReader implements IReader
$formatArray['font']['bold'] = true; $formatArray['font']['bold'] = true;
break; break;
case 'T': case 'T':
$formatArray['borders']['top']['style'] = Border::BORDER_THIN; $formatArray['borders']['top']['borderStyle'] = Border::BORDER_THIN;
break; break;
case 'B': case 'B':
$formatArray['borders']['bottom']['style'] = Border::BORDER_THIN; $formatArray['borders']['bottom']['borderStyle'] = Border::BORDER_THIN;
break; break;
case 'L': case 'L':
$formatArray['borders']['left']['style'] = Border::BORDER_THIN; $formatArray['borders']['left']['borderStyle'] = Border::BORDER_THIN;
break; break;
case 'R': case 'R':
$formatArray['borders']['right']['style'] = Border::BORDER_THIN; $formatArray['borders']['right']['borderStyle'] = Border::BORDER_THIN;
break; break;
} }
} }
@ -401,16 +401,16 @@ class Slk extends BaseReader implements IReader
$styleData['font']['bold'] = true; $styleData['font']['bold'] = true;
break; break;
case 'T': case 'T':
$styleData['borders']['top']['style'] = Border::BORDER_THIN; $styleData['borders']['top']['borderStyle'] = Border::BORDER_THIN;
break; break;
case 'B': case 'B':
$styleData['borders']['bottom']['style'] = Border::BORDER_THIN; $styleData['borders']['bottom']['borderStyle'] = Border::BORDER_THIN;
break; break;
case 'L': case 'L':
$styleData['borders']['left']['style'] = Border::BORDER_THIN; $styleData['borders']['left']['borderStyle'] = Border::BORDER_THIN;
break; break;
case 'R': case 'R':
$styleData['borders']['right']['style'] = Border::BORDER_THIN; $styleData['borders']['right']['borderStyle'] = Border::BORDER_THIN;
break; break;
} }
} }

View File

@ -1942,7 +1942,7 @@ class Xls extends BaseReader implements IReader
} }
// bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8) // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
// bit: 3; mask 0x0008; strike // bit: 3; mask 0x0008; strikethrough
$isStrike = (0x0008 & self::getInt2d($recordData, 2)) >> 3; $isStrike = (0x0008 & self::getInt2d($recordData, 2)) >> 3;
if ($isStrike) { if ($isStrike) {
$objFont->setStrikethrough(true); $objFont->setStrikethrough(true);
@ -1964,10 +1964,10 @@ class Xls extends BaseReader implements IReader
$escapement = self::getInt2d($recordData, 8); $escapement = self::getInt2d($recordData, 8);
switch ($escapement) { switch ($escapement) {
case 0x0001: case 0x0001:
$objFont->setSuperScript(true); $objFont->setSuperscript(true);
break; break;
case 0x0002: case 0x0002:
$objFont->setSubScript(true); $objFont->setSubscript(true);
break; break;
} }
@ -2081,15 +2081,15 @@ class Xls extends BaseReader implements IReader
$numberFormatIndex = self::getInt2d($recordData, 2); $numberFormatIndex = self::getInt2d($recordData, 2);
if (isset($this->formats[$numberFormatIndex])) { if (isset($this->formats[$numberFormatIndex])) {
// then we have user-defined format code // then we have user-defined format code
$numberformat = ['code' => $this->formats[$numberFormatIndex]]; $numberFormat = ['formatCode' => $this->formats[$numberFormatIndex]];
} elseif (($code = NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') { } elseif (($code = NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') {
// then we have built-in format code // then we have built-in format code
$numberformat = ['code' => $code]; $numberFormat = ['formatCode' => $code];
} else { } else {
// we set the general format code // we set the general format code
$numberformat = ['code' => 'General']; $numberFormat = ['formatCode' => 'General'];
} }
$objStyle->getNumberFormat()->setFormatCode($numberformat['code']); $objStyle->getNumberFormat()->setFormatCode($numberFormat['formatCode']);
// offset: 4; size: 2; XF type, cell protection, and parent style XF // offset: 4; size: 2; XF type, cell protection, and parent style XF
// bit 2-0; mask 0x0007; XF_TYPE_PROT // bit 2-0; mask 0x0007; XF_TYPE_PROT

View File

@ -1918,10 +1918,10 @@ class Xlsx extends BaseReader implements IReader
if (isset($style->font->vertAlign) && isset($style->font->vertAlign['val'])) { if (isset($style->font->vertAlign) && isset($style->font->vertAlign['val'])) {
$vertAlign = strtolower((string) $style->font->vertAlign['val']); $vertAlign = strtolower((string) $style->font->vertAlign['val']);
if ($vertAlign == 'superscript') { if ($vertAlign == 'superscript') {
$docStyle->getFont()->setSuperScript(true); $docStyle->getFont()->setSuperscript(true);
} }
if ($vertAlign == 'subscript') { if ($vertAlign == 'subscript') {
$docStyle->getFont()->setSubScript(true); $docStyle->getFont()->setSubscript(true);
} }
} }
} }
@ -1988,7 +1988,7 @@ class Xlsx extends BaseReader implements IReader
$docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment['wrapText'])); $docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment['wrapText']));
$docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment['shrinkToFit'])); $docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment['shrinkToFit']));
$docStyle->getAlignment()->setIndent((int) ((string) $style->alignment['indent']) > 0 ? (int) ((string) $style->alignment['indent']) : 0); $docStyle->getAlignment()->setIndent((int) ((string) $style->alignment['indent']) > 0 ? (int) ((string) $style->alignment['indent']) : 0);
$docStyle->getAlignment()->setReadorder((int) ((string) $style->alignment['readingOrder']) > 0 ? (int) ((string) $style->alignment['readingOrder']) : 0); $docStyle->getAlignment()->setReadOrder((int) ((string) $style->alignment['readingOrder']) > 0 ? (int) ((string) $style->alignment['readingOrder']) : 0);
} }
// protection // protection
@ -2069,10 +2069,10 @@ class Xlsx extends BaseReader implements IReader
if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign['val'])) { if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign['val'])) {
$vertAlign = strtolower((string) $run->rPr->vertAlign['val']); $vertAlign = strtolower((string) $run->rPr->vertAlign['val']);
if ($vertAlign == 'superscript') { if ($vertAlign == 'superscript') {
$objText->getFont()->setSuperScript(true); $objText->getFont()->setSuperscript(true);
} }
if ($vertAlign == 'subscript') { if ($vertAlign == 'subscript') {
$objText->getFont()->setSubScript(true); $objText->getFont()->setSubscript(true);
} }
} }
if (isset($run->rPr->u) && !isset($run->rPr->u['val'])) { if (isset($run->rPr->u) && !isset($run->rPr->u['val'])) {

View File

@ -445,9 +445,9 @@ class Chart
$baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
if (!is_null($baseline)) { if (!is_null($baseline)) {
if ($baseline > 0) { if ($baseline > 0) {
$objText->getFont()->setSuperScript(true); $objText->getFont()->setSuperscript(true);
} elseif ($baseline < 0) { } elseif ($baseline < 0) {
$objText->getFont()->setSubScript(true); $objText->getFont()->setSubscript(true);
} }
} }

View File

@ -441,7 +441,7 @@ class Xml extends BaseReader implements IReader
} }
break; break;
case 'WrapText': case 'WrapText':
$this->styles[$styleID]['alignment']['wrap'] = true; $this->styles[$styleID]['alignment']['wrapText'] = true;
break; break;
} }
} }
@ -453,7 +453,7 @@ class Xml extends BaseReader implements IReader
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) { foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
switch ($borderStyleKey) { switch ($borderStyleKey) {
case 'LineStyle': case 'LineStyle':
$thisBorder['style'] = Border::BORDER_MEDIUM; $thisBorder['borderStyle'] = Border::BORDER_MEDIUM;
break; break;
case 'Weight': case 'Weight':
break; break;
@ -507,7 +507,7 @@ class Xml extends BaseReader implements IReader
$this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1); $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
case 'Pattern': case 'Pattern':
$this->styles[$styleID]['fill']['type'] = strtolower($styleAttributeValue); $this->styles[$styleID]['fill']['fillType'] = strtolower($styleAttributeValue);
break; break;
} }
} }
@ -521,7 +521,7 @@ class Xml extends BaseReader implements IReader
break; break;
} }
if ($styleAttributeValue > '') { if ($styleAttributeValue > '') {
$this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue; $this->styles[$styleID]['numberFormat']['formatCode'] = $styleAttributeValue;
} }
} }
break; break;

View File

@ -177,20 +177,20 @@ class Style extends Style\Supervisor implements IComparable
* 'bold' => true, * 'bold' => true,
* 'italic' => false, * 'italic' => false,
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, * 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
* 'strike' => false, * 'strikethrough' => false,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
* ), * ),
* 'borders' => array( * 'borders' => array(
* 'bottom' => array( * 'bottom' => array(
* 'style' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
* ), * ),
* 'top' => array( * 'top' => array(
* 'style' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
@ -241,15 +241,15 @@ class Style extends Style\Supervisor implements IComparable
// ADVANCED MODE: // ADVANCED MODE:
if ($pAdvanced && isset($pStyles['borders'])) { if ($pAdvanced && isset($pStyles['borders'])) {
// 'allborders' is a shorthand property for 'outline' and 'inside' and // 'allBorders' is a shorthand property for 'outline' and 'inside' and
// it applies to components that have not been set explicitly // it applies to components that have not been set explicitly
if (isset($pStyles['borders']['allborders'])) { if (isset($pStyles['borders']['allBorders'])) {
foreach (['outline', 'inside'] as $component) { foreach (['outline', 'inside'] as $component) {
if (!isset($pStyles['borders'][$component])) { if (!isset($pStyles['borders'][$component])) {
$pStyles['borders'][$component] = $pStyles['borders']['allborders']; $pStyles['borders'][$component] = $pStyles['borders']['allBorders'];
} }
} }
unset($pStyles['borders']['allborders']); // not needed any more unset($pStyles['borders']['allBorders']); // not needed any more
} }
// 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left' // 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left'
// it applies to components that have not been set explicitly // it applies to components that have not been set explicitly
@ -452,8 +452,8 @@ class Style extends Style\Supervisor implements IComparable
if (isset($pStyles['alignment'])) { if (isset($pStyles['alignment'])) {
$this->getAlignment()->applyFromArray($pStyles['alignment']); $this->getAlignment()->applyFromArray($pStyles['alignment']);
} }
if (isset($pStyles['numberformat'])) { if (isset($pStyles['numberFormat'])) {
$this->getNumberFormat()->applyFromArray($pStyles['numberformat']); $this->getNumberFormat()->applyFromArray($pStyles['numberFormat']);
} }
if (isset($pStyles['protection'])) { if (isset($pStyles['protection'])) {
$this->getProtection()->applyFromArray($pStyles['protection']); $this->getProtection()->applyFromArray($pStyles['protection']);

View File

@ -98,7 +98,7 @@ class Alignment extends Supervisor implements IComparable
* *
* @var int * @var int
*/ */
protected $readorder = 0; protected $readOrder = 0;
/** /**
* Create a new Alignment. * Create a new Alignment.
@ -152,8 +152,8 @@ class Alignment extends Supervisor implements IComparable
* array( * array(
* 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, * 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
* 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, * 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
* 'rotation' => 0, * 'textRotation' => 0,
* 'wrap' => TRUE * 'wrapText' => TRUE
* ) * )
* ); * );
* </code>. * </code>.
@ -176,11 +176,11 @@ class Alignment extends Supervisor implements IComparable
if (isset($pStyles['vertical'])) { if (isset($pStyles['vertical'])) {
$this->setVertical($pStyles['vertical']); $this->setVertical($pStyles['vertical']);
} }
if (isset($pStyles['rotation'])) { if (isset($pStyles['textRotation'])) {
$this->setTextRotation($pStyles['rotation']); $this->setTextRotation($pStyles['textRotation']);
} }
if (isset($pStyles['wrap'])) { if (isset($pStyles['wrapText'])) {
$this->setWrapText($pStyles['wrap']); $this->setWrapText($pStyles['wrapText']);
} }
if (isset($pStyles['shrinkToFit'])) { if (isset($pStyles['shrinkToFit'])) {
$this->setShrinkToFit($pStyles['shrinkToFit']); $this->setShrinkToFit($pStyles['shrinkToFit']);
@ -188,8 +188,8 @@ class Alignment extends Supervisor implements IComparable
if (isset($pStyles['indent'])) { if (isset($pStyles['indent'])) {
$this->setIndent($pStyles['indent']); $this->setIndent($pStyles['indent']);
} }
if (isset($pStyles['readorder'])) { if (isset($pStyles['readOrder'])) {
$this->setReadorder($pStyles['readorder']); $this->setReadOrder($pStyles['readOrder']);
} }
} }
@ -303,7 +303,7 @@ class Alignment extends Supervisor implements IComparable
// Set rotation // Set rotation
if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) { if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) {
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['rotation' => $pValue]); $styleArray = $this->getStyleArray(['textRotation' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->textRotation = $pValue; $this->textRotation = $pValue;
@ -342,7 +342,7 @@ class Alignment extends Supervisor implements IComparable
$pValue = false; $pValue = false;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['wrap' => $pValue]); $styleArray = $this->getStyleArray(['wrapText' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->wrapText = $pValue; $this->wrapText = $pValue;
@ -432,13 +432,13 @@ class Alignment extends Supervisor implements IComparable
* *
* @return int * @return int
*/ */
public function getReadorder() public function getReadOrder()
{ {
if ($this->isSupervisor) { if ($this->isSupervisor) {
return $this->getSharedComponent()->getReadorder(); return $this->getSharedComponent()->getReadOrder();
} }
return $this->readorder; return $this->readOrder;
} }
/** /**
@ -448,16 +448,16 @@ class Alignment extends Supervisor implements IComparable
* *
* @return Alignment * @return Alignment
*/ */
public function setReadorder($pValue) public function setReadOrder($pValue)
{ {
if ($pValue < 0 || $pValue > 2) { if ($pValue < 0 || $pValue > 2) {
$pValue = 0; $pValue = 0;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['readorder' => $pValue]); $styleArray = $this->getStyleArray(['readOrder' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->readorder = $pValue; $this->readOrder = $pValue;
} }
return $this; return $this;
@ -481,7 +481,7 @@ class Alignment extends Supervisor implements IComparable
($this->wrapText ? 't' : 'f') . ($this->wrapText ? 't' : 'f') .
($this->shrinkToFit ? 't' : 'f') . ($this->shrinkToFit ? 't' : 'f') .
$this->indent . $this->indent .
$this->readorder . $this->readOrder .
__CLASS__ __CLASS__
); );
} }

View File

@ -146,22 +146,7 @@ class Border extends Supervisor implements IComparable
*/ */
public function getStyleArray($array) public function getStyleArray($array)
{ {
switch ($this->parentPropertyName) { return $this->parent->getStyleArray([$this->parentPropertyName => $array]);
case 'allborders':
case 'bottom':
case 'diagonal':
case 'horizontal':
case 'inside':
case 'left':
case 'outline':
case 'right':
case 'top':
case 'vertical':
$key = strtolower($this->parentPropertyName);
break;
}
return $this->parent->getStyleArray([$key => $array]);
} }
/** /**
@ -170,7 +155,7 @@ class Border extends Supervisor implements IComparable
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray(
* array( * array(
* 'style' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
@ -189,8 +174,8 @@ class Border extends Supervisor implements IComparable
if ($this->isSupervisor) { if ($this->isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else { } else {
if (isset($pStyles['style'])) { if (isset($pStyles['borderStyle'])) {
$this->setBorderStyle($pStyles['style']); $this->setBorderStyle($pStyles['borderStyle']);
} }
if (isset($pStyles['color'])) { if (isset($pStyles['color'])) {
$this->getColor()->applyFromArray($pStyles['color']); $this->getColor()->applyFromArray($pStyles['color']);
@ -231,7 +216,7 @@ class Border extends Supervisor implements IComparable
$pValue = self::BORDER_MEDIUM; $pValue = self::BORDER_MEDIUM;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['style' => $pValue]); $styleArray = $this->getStyleArray(['borderStyle' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->borderStyle = $pValue; $this->borderStyle = $pValue;

View File

@ -187,13 +187,13 @@ class Borders extends Supervisor implements IComparable
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* array( * array(
* 'bottom' => array( * 'bottom' => array(
* 'style' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
* ), * ),
* 'top' => array( * 'top' => array(
* 'style' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
@ -204,8 +204,8 @@ class Borders extends Supervisor implements IComparable
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* array( * array(
* 'allborders' => array( * 'allBorders' => array(
* 'style' => Border::BORDER_DASHDOT, * 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
@ -240,14 +240,14 @@ class Borders extends Supervisor implements IComparable
if (isset($pStyles['diagonal'])) { if (isset($pStyles['diagonal'])) {
$this->getDiagonal()->applyFromArray($pStyles['diagonal']); $this->getDiagonal()->applyFromArray($pStyles['diagonal']);
} }
if (isset($pStyles['diagonaldirection'])) { if (isset($pStyles['diagonalDirection'])) {
$this->setDiagonalDirection($pStyles['diagonaldirection']); $this->setDiagonalDirection($pStyles['diagonalDirection']);
} }
if (isset($pStyles['allborders'])) { if (isset($pStyles['allBorders'])) {
$this->getLeft()->applyFromArray($pStyles['allborders']); $this->getLeft()->applyFromArray($pStyles['allBorders']);
$this->getRight()->applyFromArray($pStyles['allborders']); $this->getRight()->applyFromArray($pStyles['allBorders']);
$this->getTop()->applyFromArray($pStyles['allborders']); $this->getTop()->applyFromArray($pStyles['allBorders']);
$this->getBottom()->applyFromArray($pStyles['allborders']); $this->getBottom()->applyFromArray($pStyles['allBorders']);
} }
} }
@ -411,7 +411,7 @@ class Borders extends Supervisor implements IComparable
$pValue = self::DIAGONAL_NONE; $pValue = self::DIAGONAL_NONE;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['diagonaldirection' => $pValue]); $styleArray = $this->getStyleArray(['diagonalDirection' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->diagonalDirection = $pValue; $this->diagonalDirection = $pValue;

View File

@ -127,19 +127,7 @@ class Color extends Supervisor implements IComparable
*/ */
public function getStyleArray($array) public function getStyleArray($array)
{ {
switch ($this->parentPropertyName) { return $this->parent->getStyleArray([$this->parentPropertyName => $array]);
case 'endColor':
$key = 'endcolor';
break;
case 'color':
$key = 'color';
break;
case 'startColor':
$key = 'startcolor';
break;
}
return $this->parent->getStyleArray([$key => $array]);
} }
/** /**

View File

@ -137,12 +137,12 @@ class Fill extends Supervisor implements IComparable
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
* array( * array(
* 'type' => Fill::FILL_GRADIENT_LINEAR, * 'fillType' => Fill::FILL_GRADIENT_LINEAR,
* 'rotation' => 0, * 'rotation' => 0,
* 'startcolor' => array( * 'startColor' => array(
* 'rgb' => '000000' * 'rgb' => '000000'
* ), * ),
* 'endcolor' => array( * 'endColor' => array(
* 'argb' => 'FFFFFFFF' * 'argb' => 'FFFFFFFF'
* ) * )
* ) * )
@ -160,17 +160,17 @@ class Fill extends Supervisor implements IComparable
if ($this->isSupervisor) { if ($this->isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else { } else {
if (isset($pStyles['type'])) { if (isset($pStyles['fillType'])) {
$this->setFillType($pStyles['type']); $this->setFillType($pStyles['fillType']);
} }
if (isset($pStyles['rotation'])) { if (isset($pStyles['rotation'])) {
$this->setRotation($pStyles['rotation']); $this->setRotation($pStyles['rotation']);
} }
if (isset($pStyles['startcolor'])) { if (isset($pStyles['startColor'])) {
$this->getStartColor()->applyFromArray($pStyles['startcolor']); $this->getStartColor()->applyFromArray($pStyles['startColor']);
} }
if (isset($pStyles['endcolor'])) { if (isset($pStyles['endColor'])) {
$this->getEndColor()->applyFromArray($pStyles['endcolor']); $this->getEndColor()->applyFromArray($pStyles['endColor']);
} }
if (isset($pStyles['color'])) { if (isset($pStyles['color'])) {
$this->getStartColor()->applyFromArray($pStyles['color']); $this->getStartColor()->applyFromArray($pStyles['color']);
@ -205,7 +205,7 @@ class Fill extends Supervisor implements IComparable
public function setFillType($pValue) public function setFillType($pValue)
{ {
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['type' => $pValue]); $styleArray = $this->getStyleArray(['fillType' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->fillType = $pValue; $this->fillType = $pValue;

View File

@ -69,14 +69,14 @@ class Font extends Supervisor implements IComparable
* *
* @var bool * @var bool
*/ */
protected $superScript = false; protected $superscript = false;
/** /**
* Subscript. * Subscript.
* *
* @var bool * @var bool
*/ */
protected $subScript = false; protected $subscript = false;
/** /**
* Underline. * Underline.
@ -120,8 +120,8 @@ class Font extends Supervisor implements IComparable
$this->size = null; $this->size = null;
$this->bold = null; $this->bold = null;
$this->italic = null; $this->italic = null;
$this->superScript = null; $this->superscript = null;
$this->subScript = null; $this->subscript = null;
$this->underline = null; $this->underline = null;
$this->strikethrough = null; $this->strikethrough = null;
$this->color = new Color(Color::COLOR_BLACK, $isSupervisor, $isConditional); $this->color = new Color(Color::COLOR_BLACK, $isSupervisor, $isConditional);
@ -166,7 +166,7 @@ class Font extends Supervisor implements IComparable
* 'bold' => TRUE, * 'bold' => TRUE,
* 'italic' => FALSE, * 'italic' => FALSE,
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, * 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
* 'strike' => FALSE, * 'strikethrough' => FALSE,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
@ -194,17 +194,17 @@ class Font extends Supervisor implements IComparable
if (isset($pStyles['italic'])) { if (isset($pStyles['italic'])) {
$this->setItalic($pStyles['italic']); $this->setItalic($pStyles['italic']);
} }
if (isset($pStyles['superScript'])) { if (isset($pStyles['superscript'])) {
$this->setSuperScript($pStyles['superScript']); $this->setSuperscript($pStyles['superscript']);
} }
if (isset($pStyles['subScript'])) { if (isset($pStyles['subscript'])) {
$this->setSubScript($pStyles['subScript']); $this->setSubscript($pStyles['subscript']);
} }
if (isset($pStyles['underline'])) { if (isset($pStyles['underline'])) {
$this->setUnderline($pStyles['underline']); $this->setUnderline($pStyles['underline']);
} }
if (isset($pStyles['strike'])) { if (isset($pStyles['strikethrough'])) {
$this->setStrikethrough($pStyles['strike']); $this->setStrikethrough($pStyles['strikethrough']);
} }
if (isset($pStyles['color'])) { if (isset($pStyles['color'])) {
$this->getColor()->applyFromArray($pStyles['color']); $this->getColor()->applyFromArray($pStyles['color']);
@ -362,74 +362,74 @@ class Font extends Supervisor implements IComparable
} }
/** /**
* Get SuperScript. * Get Superscript.
* *
* @return bool * @return bool
*/ */
public function getSuperScript() public function getSuperscript()
{ {
if ($this->isSupervisor) { if ($this->isSupervisor) {
return $this->getSharedComponent()->getSuperScript(); return $this->getSharedComponent()->getSuperscript();
} }
return $this->superScript; return $this->superscript;
} }
/** /**
* Set SuperScript. * Set Superscript.
* *
* @param bool $pValue * @param bool $pValue
* *
* @return Font * @return Font
*/ */
public function setSuperScript($pValue) public function setSuperscript($pValue)
{ {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['superScript' => $pValue]); $styleArray = $this->getStyleArray(['superscript' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->superScript = $pValue; $this->superscript = $pValue;
$this->subScript = !$pValue; $this->subscript = !$pValue;
} }
return $this; return $this;
} }
/** /**
* Get SubScript. * Get Subscript.
* *
* @return bool * @return bool
*/ */
public function getSubScript() public function getSubscript()
{ {
if ($this->isSupervisor) { if ($this->isSupervisor) {
return $this->getSharedComponent()->getSubScript(); return $this->getSharedComponent()->getSubscript();
} }
return $this->subScript; return $this->subscript;
} }
/** /**
* Set SubScript. * Set Subscript.
* *
* @param bool $pValue * @param bool $pValue
* *
* @return Font * @return Font
*/ */
public function setSubScript($pValue) public function setSubscript($pValue)
{ {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['subScript' => $pValue]); $styleArray = $this->getStyleArray(['subscript' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->subScript = $pValue; $this->subscript = $pValue;
$this->superScript = !$pValue; $this->superscript = !$pValue;
} }
return $this; return $this;
@ -561,8 +561,8 @@ class Font extends Supervisor implements IComparable
$this->size . $this->size .
($this->bold ? 't' : 'f') . ($this->bold ? 't' : 'f') .
($this->italic ? 't' : 'f') . ($this->italic ? 't' : 'f') .
($this->superScript ? 't' : 'f') . ($this->superscript ? 't' : 'f') .
($this->subScript ? 't' : 'f') . ($this->subscript ? 't' : 'f') .
$this->underline . $this->underline .
($this->strikethrough ? 't' : 'f') . ($this->strikethrough ? 't' : 'f') .
$this->color->getHashCode() . $this->color->getHashCode() .

View File

@ -141,7 +141,7 @@ class NumberFormat extends Supervisor implements IComparable
*/ */
public function getStyleArray($array) public function getStyleArray($array)
{ {
return ['numberformat' => $array]; return ['numberFormat' => $array];
} }
/** /**
@ -149,7 +149,7 @@ class NumberFormat extends Supervisor implements IComparable
* <code> * <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( * $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
* array( * array(
* 'code' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE * 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
* ) * )
* ); * );
* </code>. * </code>.
@ -165,8 +165,8 @@ class NumberFormat extends Supervisor implements IComparable
if ($this->isSupervisor) { if ($this->isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else { } else {
if (isset($pStyles['code'])) { if (isset($pStyles['formatCode'])) {
$this->setFormatCode($pStyles['code']); $this->setFormatCode($pStyles['formatCode']);
} }
} }
@ -203,7 +203,7 @@ class NumberFormat extends Supervisor implements IComparable
$pValue = self::FORMAT_GENERAL; $pValue = self::FORMAT_GENERAL;
} }
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['code' => $pValue]); $styleArray = $this->getStyleArray(['formatCode' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->formatCode = $pValue; $this->formatCode = $pValue;
@ -237,7 +237,7 @@ class NumberFormat extends Supervisor implements IComparable
public function setBuiltInFormatCode($pValue) public function setBuiltInFormatCode($pValue)
{ {
if ($this->isSupervisor) { if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['code' => self::builtInFormatCode($pValue)]); $styleArray = $this->getStyleArray(['formatCode' => self::builtInFormatCode($pValue)]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->builtInFormatCode = $pValue; $this->builtInFormatCode = $pValue;

View File

@ -1266,9 +1266,9 @@ class Html extends BaseWriter implements IWriter
if ($element instanceof RichText\Run) { if ($element instanceof RichText\Run) {
$cellData .= '<span style="' . $this->assembleCSS($this->createCSSStyleFont($element->getFont())) . '">'; $cellData .= '<span style="' . $this->assembleCSS($this->createCSSStyleFont($element->getFont())) . '">';
if ($element->getFont()->getSuperScript()) { if ($element->getFont()->getSuperscript()) {
$cellData .= '<sup>'; $cellData .= '<sup>';
} elseif ($element->getFont()->getSubScript()) { } elseif ($element->getFont()->getSubscript()) {
$cellData .= '<sub>'; $cellData .= '<sub>';
} }
} }
@ -1278,9 +1278,9 @@ class Html extends BaseWriter implements IWriter
$cellData .= htmlspecialchars($cellText); $cellData .= htmlspecialchars($cellText);
if ($element instanceof RichText\Run) { if ($element instanceof RichText\Run) {
if ($element->getFont()->getSuperScript()) { if ($element->getFont()->getSuperscript()) {
$cellData .= '</sup>'; $cellData .= '</sup>';
} elseif ($element->getFont()->getSubScript()) { } elseif ($element->getFont()->getSubscript()) {
$cellData .= '</sub>'; $cellData .= '</sub>';
} }
@ -1302,9 +1302,9 @@ class Html extends BaseWriter implements IWriter
); );
} }
$cellData = htmlspecialchars($cellData); $cellData = htmlspecialchars($cellData);
if ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSuperScript()) { if ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSuperscript()) {
$cellData = '<sup>' . $cellData . '</sup>'; $cellData = '<sup>' . $cellData . '</sup>';
} elseif ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSubScript()) { } elseif ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSubscript()) {
$cellData = '<sub>' . $cellData . '</sub>'; $cellData = '<sub>' . $cellData . '</sub>';
} }
} }

View File

@ -74,9 +74,9 @@ class Font
$font_shadow = 0; $font_shadow = 0;
$icv = $this->colorIndex; // Index to color palette $icv = $this->colorIndex; // Index to color palette
if ($this->font->getSuperScript()) { if ($this->font->getSuperscript()) {
$sss = 1; $sss = 1;
} elseif ($this->font->getSubScript()) { } elseif ($this->font->getSubscript()) {
$sss = 2; $sss = 2;
} else { } else {
$sss = 0; $sss = 0;

View File

@ -3160,8 +3160,8 @@ class Worksheet extends BIFFwriter
|| $conditional->getStyle()->getFont()->getSize() != null || $conditional->getStyle()->getFont()->getSize() != null
|| $conditional->getStyle()->getFont()->getBold() != null || $conditional->getStyle()->getFont()->getBold() != null
|| $conditional->getStyle()->getFont()->getItalic() != null || $conditional->getStyle()->getFont()->getItalic() != null
|| $conditional->getStyle()->getFont()->getSuperScript() != null || $conditional->getStyle()->getFont()->getSuperscript() != null
|| $conditional->getStyle()->getFont()->getSubScript() != null || $conditional->getStyle()->getFont()->getSubscript() != null
|| $conditional->getStyle()->getFont()->getUnderline() != null || $conditional->getStyle()->getFont()->getUnderline() != null
|| $conditional->getStyle()->getFont()->getStrikethrough() != null || $conditional->getStyle()->getFont()->getStrikethrough() != null
|| $conditional->getStyle()->getFont()->getColor()->getARGB() != null) { || $conditional->getStyle()->getFont()->getColor()->getARGB() != null) {
@ -3233,10 +3233,10 @@ class Worksheet extends BIFFwriter
$dataBlockFont .= pack('v', 0x0190); $dataBlockFont .= pack('v', 0x0190);
} }
// Escapement type // Escapement type
if ($conditional->getStyle()->getFont()->getSubScript() == true) { if ($conditional->getStyle()->getFont()->getSubscript() == true) {
$dataBlockFont .= pack('v', 0x02); $dataBlockFont .= pack('v', 0x02);
$fontEscapement = 0; $fontEscapement = 0;
} elseif ($conditional->getStyle()->getFont()->getSuperScript() == true) { } elseif ($conditional->getStyle()->getFont()->getSuperscript() == true) {
$dataBlockFont .= pack('v', 0x01); $dataBlockFont .= pack('v', 0x01);
$fontEscapement = 0; $fontEscapement = 0;
} else { } else {

View File

@ -477,7 +477,7 @@ class Drawing extends WriterPart
// o:lock // o:lock
$objWriter->startElement('o:lock'); $objWriter->startElement('o:lock');
$objWriter->writeAttribute('v:ext', 'edit'); $objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('rotation', 't'); $objWriter->writeAttribute('textRotation', 't');
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();

View File

@ -175,11 +175,11 @@ class StringTable extends WriterPart
$objWriter->endElement(); $objWriter->endElement();
// Superscript / subscript // Superscript / subscript
if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) { if ($element->getFont()->getSuperscript() || $element->getFont()->getSubscript()) {
$objWriter->startElement($prefix . 'vertAlign'); $objWriter->startElement($prefix . 'vertAlign');
if ($element->getFont()->getSuperScript()) { if ($element->getFont()->getSuperscript()) {
$objWriter->writeAttribute('val', 'superscript'); $objWriter->writeAttribute('val', 'superscript');
} elseif ($element->getFont()->getSubScript()) { } elseif ($element->getFont()->getSubscript()) {
$objWriter->writeAttribute('val', 'subscript'); $objWriter->writeAttribute('val', 'subscript');
} }
$objWriter->endElement(); $objWriter->endElement();

View File

@ -320,11 +320,11 @@ class Style extends WriterPart
} }
// Superscript / subscript // Superscript / subscript
if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) { if ($pFont->getSuperscript() === true || $pFont->getSubscript() === true) {
$objWriter->startElement('vertAlign'); $objWriter->startElement('vertAlign');
if ($pFont->getSuperScript() === true) { if ($pFont->getSuperscript() === true) {
$objWriter->writeAttribute('val', 'superscript'); $objWriter->writeAttribute('val', 'superscript');
} elseif ($pFont->getSubScript() === true) { } elseif ($pFont->getSubscript() === true) {
$objWriter->writeAttribute('val', 'subscript'); $objWriter->writeAttribute('val', 'subscript');
} }
$objWriter->endElement(); $objWriter->endElement();
@ -448,8 +448,8 @@ class Style extends WriterPart
if ($pStyle->getAlignment()->getIndent() > 0) { if ($pStyle->getAlignment()->getIndent() > 0) {
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent()); $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
} }
if ($pStyle->getAlignment()->getReadorder() > 0) { if ($pStyle->getAlignment()->getReadOrder() > 0) {
$objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder()); $objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadOrder());
} }
$objWriter->endElement(); $objWriter->endElement();

View File

@ -0,0 +1,26 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Style;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PHPUnit_Framework_TestCase;
class BorderTest extends PHPUnit_Framework_TestCase
{
public function testCase()
{
$spreadsheet = new Spreadsheet();
$borders = $spreadsheet->getActiveSheet()->getStyle('A1')->getBorders();
$allBorders = $borders->getAllBorders();
$bottom = $borders->getBottom();
$actual = $bottom->getBorderStyle();
$this->assertSame(Border::BORDER_NONE, $actual, 'should default to none');
$allBorders->setBorderStyle(Border::BORDER_THIN);
$actual = $bottom->getBorderStyle();
$this->assertSame(Border::BORDER_THIN, $actual, 'should have been set via allBorders');
}
}