Merge branch 'master' into PHP8-Testing
This commit is contained in:
commit
fdee43cfa1
|
@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
- Improve Coverage for ODS Reader [#1545](https://github.com/phpoffice/phpspreadsheet/pull/1545)
|
- Improve Coverage for ODS Reader [#1545](https://github.com/phpoffice/phpspreadsheet/pull/1545)
|
||||||
- Named formula implementation, and improved handling of Defined Names generally [#1535](https://github.com/PHPOffice/PhpSpreadsheet/pull/1535)
|
- Named formula implementation, and improved handling of Defined Names generally [#1535](https://github.com/PHPOffice/PhpSpreadsheet/pull/1535)
|
||||||
- fix resolution of relative named range values in the calculation engine; previously all named range values had been treated as absolute.
|
- fix resolution of relative named range values in the calculation engine; previously all named range values had been treated as absolute.
|
||||||
|
- Drop $this->spreadSheet null check from Xlsx Writer [#1646](https://github.com/phpoffice/phpspreadsheet/pull/1646)
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
@ -49,6 +50,10 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- PrintArea causes exception [#1544](https://github.com/phpoffice/phpspreadsheet/pull/1544)
|
- PrintArea causes exception [#1544](https://github.com/phpoffice/phpspreadsheet/pull/1544)
|
||||||
|
- Calculation/DateTime Failure With PHP8 [#1661](https://github.com/phpoffice/phpspreadsheet/pull/1661)
|
||||||
|
- Reader/Gnumeric Failure with PHP8 [#1662](https://github.com/phpoffice/phpspreadsheet/pull/1662)
|
||||||
|
- ReverseSort bug, exposed but not caused by PHP8 [#1660](https://github.com/phpoffice/phpspreadsheet/pull/1660)
|
||||||
|
- Bug setting Superscript/Subscript to false [#1567](https://github.com/phpoffice/phpspreadsheet/pull/1567)
|
||||||
|
|
||||||
## 1.14.1 - 2020-07-19
|
## 1.14.1 - 2020-07-19
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
[![License](https://poser.pugx.org/phpoffice/phpspreadsheet/license.png)](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
[![License](https://poser.pugx.org/phpoffice/phpspreadsheet/license.png)](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||||
[![Join the chat at https://gitter.im/PHPOffice/PhpSpreadsheet](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PhpSpreadsheet)
|
[![Join the chat at https://gitter.im/PHPOffice/PhpSpreadsheet](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PhpSpreadsheet)
|
||||||
|
|
||||||
PhpSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to read from and to write to different spreadsheet file formats, like Excel and LibreOffice Calc.
|
PhpSpreadsheet is a library written in pure PHP and offers a set of classes that
|
||||||
|
allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
![Logo](./assets/logo.svg)
|
![Logo](./assets/logo.svg)
|
||||||
|
|
||||||
PhpSpreadsheet is a library written in pure PHP and providing a set of
|
PhpSpreadsheet is a library written in pure PHP and offers a set of classes that
|
||||||
classes that allow you to read from and to write to different
|
allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc.
|
||||||
spreadsheet file formats, like Excel and LibreOffice Calc.
|
|
||||||
|
|
||||||
## File formats supported
|
## File formats supported
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,8 @@ class Gnumeric extends BaseReader
|
||||||
|
|
||||||
$endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
|
$endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
|
||||||
$endColumn = Coordinate::stringFromColumnIndex($endColumn + 1);
|
$endColumn = Coordinate::stringFromColumnIndex($endColumn + 1);
|
||||||
$endRow = 1 + (($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow']);
|
|
||||||
|
$endRow = 1 + (($styleAttributes['endRow'] > $maxRow) ? $maxRow : (int) $styleAttributes['endRow']);
|
||||||
$cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow;
|
$cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow;
|
||||||
|
|
||||||
$styleAttributes = $styleRegion->Style->attributes();
|
$styleAttributes = $styleRegion->Style->attributes();
|
||||||
|
|
|
@ -69,7 +69,7 @@ class ReferenceHelper
|
||||||
*/
|
*/
|
||||||
public static function columnReverseSort($a, $b)
|
public static function columnReverseSort($a, $b)
|
||||||
{
|
{
|
||||||
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
return -strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ class ReferenceHelper
|
||||||
[$bc, $br] = sscanf($b, '%[A-Z]%d');
|
[$bc, $br] = sscanf($b, '%[A-Z]%d');
|
||||||
|
|
||||||
if ($ar === $br) {
|
if ($ar === $br) {
|
||||||
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
return -strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($ar < $br) ? 1 : -1;
|
return ($ar < $br) ? 1 : -1;
|
||||||
|
|
|
@ -357,21 +357,18 @@ class Font extends Supervisor
|
||||||
/**
|
/**
|
||||||
* Set Superscript.
|
* Set Superscript.
|
||||||
*
|
*
|
||||||
* @param bool $pValue
|
|
||||||
*
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setSuperscript($pValue)
|
public function setSuperscript(bool $pValue)
|
||||||
{
|
{
|
||||||
if ($pValue == '') {
|
|
||||||
$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;
|
if ($this->superscript) {
|
||||||
|
$this->subscript = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -394,21 +391,18 @@ class Font extends Supervisor
|
||||||
/**
|
/**
|
||||||
* Set Subscript.
|
* Set Subscript.
|
||||||
*
|
*
|
||||||
* @param bool $pValue
|
|
||||||
*
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setSubscript($pValue)
|
public function setSubscript(bool $pValue)
|
||||||
{
|
{
|
||||||
if ($pValue == '') {
|
|
||||||
$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;
|
if ($this->subscript) {
|
||||||
|
$this->superscript = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -178,7 +178,6 @@ class Xlsx extends BaseWriter
|
||||||
*/
|
*/
|
||||||
public function save($pFilename): void
|
public function save($pFilename): void
|
||||||
{
|
{
|
||||||
if ($this->spreadSheet !== null) {
|
|
||||||
// garbage collect
|
// garbage collect
|
||||||
$this->pathNames = [];
|
$this->pathNames = [];
|
||||||
$this->spreadSheet->garbageCollect();
|
$this->spreadSheet->garbageCollect();
|
||||||
|
@ -407,9 +406,6 @@ class Xlsx extends BaseWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maybeCloseFileHandle();
|
$this->maybeCloseFileHandle();
|
||||||
} else {
|
|
||||||
throw new WriterException('PhpSpreadsheet object unassigned.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -419,13 +415,9 @@ class Xlsx extends BaseWriter
|
||||||
*/
|
*/
|
||||||
public function getSpreadsheet()
|
public function getSpreadsheet()
|
||||||
{
|
{
|
||||||
if ($this->spreadSheet !== null) {
|
|
||||||
return $this->spreadSheet;
|
return $this->spreadSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new WriterException('No Spreadsheet object assigned.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Spreadsheet object.
|
* Set Spreadsheet object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Style;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class FontTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testSuperSubScript(): void
|
||||||
|
{
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
$cell = $sheet->getCell('A1');
|
||||||
|
$cell->setValue('Cell A1');
|
||||||
|
$font = $cell->getStyle()->getFont();
|
||||||
|
$font->setSuperscript(true);
|
||||||
|
$font->setSubscript(true);
|
||||||
|
self::assertFalse($font->getSuperscript(), 'Earlier set true loses');
|
||||||
|
self::assertTrue($font->getSubscript(), 'Last set true wins');
|
||||||
|
$font->setSubscript(true);
|
||||||
|
$font->setSuperscript(true);
|
||||||
|
self::assertTrue($font->getSuperscript(), 'Last set true wins');
|
||||||
|
self::assertFalse($font->getSubscript(), 'Earlier set true loses');
|
||||||
|
$font->setSuperscript(false);
|
||||||
|
$font->setSubscript(false);
|
||||||
|
self::assertFalse($font->getSuperscript(), 'False remains unchanged');
|
||||||
|
self::assertFalse($font->getSubscript(), 'False remains unchanged');
|
||||||
|
$font->setSubscript(false);
|
||||||
|
$font->setSuperscript(false);
|
||||||
|
self::assertFalse($font->getSuperscript(), 'False remains unchanged');
|
||||||
|
self::assertFalse($font->getSubscript(), 'False remains unchanged');
|
||||||
|
$font->setSubscript(true);
|
||||||
|
$font->setSuperscript(false);
|
||||||
|
self::assertFalse($font->getSuperscript(), 'False remains unchanged');
|
||||||
|
self::assertTrue($font->getSubscript(), 'True remains unchanged');
|
||||||
|
$font->setSubscript(false);
|
||||||
|
$font->setSuperscript(true);
|
||||||
|
self::assertTrue($font->getSuperscript());
|
||||||
|
self::assertFalse($font->getSubscript(), 'False remains unchanged');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue