diff --git a/application/Espo/Tools/Export/Format/Xlsx/OpenSpoutProcessor.php b/application/Espo/Tools/Export/Format/Xlsx/OpenSpoutProcessor.php index fd3171766c..b9e0e0a229 100644 --- a/application/Espo/Tools/Export/Format/Xlsx/OpenSpoutProcessor.php +++ b/application/Espo/Tools/Export/Format/Xlsx/OpenSpoutProcessor.php @@ -47,7 +47,6 @@ use GuzzleHttp\Psr7\Stream; use LogicException; use OpenSpout\Common\Entity\Cell; use OpenSpout\Common\Entity\Style\Style; -use OpenSpout\Common\Exception\InvalidArgumentException; use OpenSpout\Common\Exception\IOException; use OpenSpout\Writer\Exception\WriterNotOpenedException; use OpenSpout\Writer\XLSX\Writer; @@ -60,7 +59,7 @@ use RuntimeException; class OpenSpoutProcessor implements ProcessorInterface { - private const FORMAT = 'xlsx'; + private const string FORMAT = 'xlsx'; /** @var array */ private array $preparatorsCache = []; @@ -79,7 +78,6 @@ class OpenSpoutProcessor implements ProcessorInterface /** * @throws IOException * @throws WriterNotOpenedException - * @throws InvalidArgumentException */ public function process(Params $params, Collection $collection): StreamInterface { @@ -100,8 +98,8 @@ class OpenSpoutProcessor implements ProcessorInterface $writer->openToFile($filePath); - $sheetView = new SheetView(); - $sheetView->setFreezeRow(2); + $sheetView = (new SheetView()) + ->withFreezeRow(2); $writer->getCurrentSheet()->setSheetView($sheetView); @@ -110,7 +108,7 @@ class OpenSpoutProcessor implements ProcessorInterface foreach ($params->getFieldList() as $name) { $label = $this->translateLabel($params->getEntityType(), $name); - $headerCells[] = Cell::fromValue($label, (new Style())->setFontBold()); + $headerCells[] = Cell::fromValue($label, (new Style())->withFontBold(true)); } $writer->addRow(new Row($headerCells)); @@ -153,6 +151,10 @@ class OpenSpoutProcessor implements ProcessorInterface return $label; } + /** + * @throws WriterNotOpenedException + * @throws IOException + */ private function processRow(Params $params, Entity $entity, Writer $writer): void { $cells = []; @@ -192,8 +194,7 @@ class OpenSpoutProcessor implements ProcessorInterface if ($value instanceof Date) { $dateFormat = self::convertDateFormat($this->dateTime->getDateFormat()); - $style = new Style(); - $style->setFormat($dateFormat); + $style = (new Style())->withFormat($dateFormat); return Cell\DateTimeCell::fromValue($value->toDateTime(), $style); } @@ -201,8 +202,7 @@ class OpenSpoutProcessor implements ProcessorInterface if ($value instanceof DateTime) { $dateTimeFormat = self::convertDateFormat($this->dateTime->getDateTimeFormat()); - $style = new Style(); - $style->setFormat($dateTimeFormat); + $style = (new Style())->withFormat($dateTimeFormat); return Cell\DateTimeCell::fromValue($value->toDateTime(), $style); } @@ -210,8 +210,7 @@ class OpenSpoutProcessor implements ProcessorInterface if ($value instanceof Currency) { $format = $this->getCurrencyFormat($value->getCode()); - $style = new Style(); - $style->setFormat($format); + $style = (new Style())->withFormat($format); return Cell\NumericCell::fromValue($value->getAmount(), $style); } diff --git a/composer.json b/composer.json index 6f8e64dbf1..715101a62c 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "league/flysystem-async-aws-s3": "^3.0", "johngrogg/ics-parser": "^3.0", "phpseclib/phpseclib": "^3.0", - "openspout/openspout": "~4.28", + "openspout/openspout": "^5.0", "dompdf/dompdf": "^3.1", "brick/phonenumber": "^0.5.0", "picqer/php-barcode-generator": "^2.4", diff --git a/composer.lock b/composer.lock index 24b9428287..cf0e5e43d0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6b385f6b808802ec6a1cb6552992578c", + "content-hash": "4fd9129460a489855141eb48be5f43e6", "packages": [ { "name": "async-aws/core", @@ -3874,36 +3874,35 @@ }, { "name": "openspout/openspout", - "version": "v4.28.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/openspout/openspout.git", - "reference": "3e9ef74f13ba5e887e4afc7a4e0110e63559e902" + "reference": "a27ee598ac091bf7631065402c1a57f832f976ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/openspout/openspout/zipball/3e9ef74f13ba5e887e4afc7a4e0110e63559e902", - "reference": "3e9ef74f13ba5e887e4afc7a4e0110e63559e902", + "url": "https://api.github.com/repos/openspout/openspout/zipball/a27ee598ac091bf7631065402c1a57f832f976ec", + "reference": "a27ee598ac091bf7631065402c1a57f832f976ec", "shasum": "" }, "require": { "ext-dom": "*", - "ext-fileinfo": "*", "ext-filter": "*", "ext-libxml": "*", "ext-xmlreader": "*", "ext-zip": "*", - "php": "~8.2.0 || ~8.3.0 || ~8.4.0" + "php": "~8.3.0 || ~8.4.0 || ~8.5.0" }, "require-dev": { "ext-zlib": "*", - "friendsofphp/php-cs-fixer": "^3.65.0", - "infection/infection": "^0.29.8", - "phpbench/phpbench": "^1.3.1", - "phpstan/phpstan": "^2.0.3", - "phpstan/phpstan-phpunit": "^2.0.1", - "phpstan/phpstan-strict-rules": "^2", - "phpunit/phpunit": "^11.4.4" + "friendsofphp/php-cs-fixer": "^3.90.0", + "infection/infection": "^0.31.9", + "phpbench/phpbench": "^1.4.3", + "phpstan/phpstan": "^2.1.32", + "phpstan/phpstan-phpunit": "^2.0.8", + "phpstan/phpstan-strict-rules": "^2.0.7", + "phpunit/phpunit": "^12.4.4" }, "suggest": { "ext-iconv": "To handle non UTF-8 CSV files (if \"php-mbstring\" is not already installed or is too limited)", @@ -3951,7 +3950,7 @@ ], "support": { "issues": "https://github.com/openspout/openspout/issues", - "source": "https://github.com/openspout/openspout/tree/v4.28.0" + "source": "https://github.com/openspout/openspout/tree/v5.0.0" }, "funding": [ { @@ -3963,7 +3962,7 @@ "type": "github" } ], - "time": "2024-11-29T09:45:53+00:00" + "time": "2025-12-01T09:20:20+00:00" }, { "name": "overtrue/pinyin", @@ -7874,16 +7873,16 @@ }, { "name": "zbateson/mail-mime-parser", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/zbateson/mail-mime-parser.git", - "reference": "e0d4423fe27850c9dd301190767dbc421acc2f19" + "reference": "ff054c8e05310c445c2028c6128a4319cc9f6aa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/e0d4423fe27850c9dd301190767dbc421acc2f19", - "reference": "e0d4423fe27850c9dd301190767dbc421acc2f19", + "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/ff054c8e05310c445c2028c6128a4319cc9f6aa8", + "reference": "ff054c8e05310c445c2028c6128a4319cc9f6aa8", "shasum": "" }, "require": { @@ -7946,7 +7945,7 @@ "type": "github" } ], - "time": "2024-08-10T18:44:09+00:00" + "time": "2025-12-02T00:29:16+00:00" }, { "name": "zbateson/mb-wrapper", @@ -9909,9 +9908,9 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "laminas/laminas-ldap": 20, "laminas/laminas-mail": 20, "laminas/laminas-mime": 20, - "laminas/laminas-ldap": 20, "zordius/lightncandy": 20 }, "prefer-stable": false, @@ -9930,6 +9929,6 @@ "ext-pdo": "*", "ext-ctype": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" }