maj ref
This commit is contained in:
parent
2b4dff08e2
commit
747f61a03d
4
.idea/nulib-spout.iml
generated
4
.idea/nulib-spout.iml
generated
@ -2,11 +2,9 @@
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="nulib\ext\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="nulib\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="nulib\ext\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/upstream-3.x/src" isTestSource="false" packagePrefix="OpenSpout\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/upstream-4.x/benchmarks" isTestSource="true" packagePrefix="OpenSpout\Benchmarks\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/upstream-4.x/src" isTestSource="false" packagePrefix="OpenSpout\" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
@ -39,7 +39,7 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"nulib\\ext\\": "src",
|
||||
"nulib\\": "src",
|
||||
"OpenSpout\\": "upstream-3.x/src"
|
||||
}
|
||||
},
|
||||
|
176
composer.lock
generated
176
composer.lock
generated
@ -12,7 +12,7 @@
|
||||
"dist": {
|
||||
"type": "path",
|
||||
"url": "../nulib",
|
||||
"reference": "876873d8fc537901bf8a0f4f1d679f93d0fbc0c9"
|
||||
"reference": "0dfb30d395c0516ba14ef3d9eb22e408bfd93d80"
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
@ -72,12 +72,12 @@
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/contracts",
|
||||
"name": "symfony/contracts"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -146,8 +146,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -367,13 +367,13 @@
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -746,16 +746,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.65.0",
|
||||
"version": "v3.68.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f"
|
||||
"reference": "b9db2b2ea3cdba7201067acee46f984ef2397cff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f",
|
||||
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/b9db2b2ea3cdba7201067acee46f984ef2397cff",
|
||||
"reference": "b9db2b2ea3cdba7201067acee46f984ef2397cff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -772,17 +772,17 @@
|
||||
"react/promise": "^2.0 || ^3.0",
|
||||
"react/socket": "^1.0",
|
||||
"react/stream": "^1.0",
|
||||
"sebastian/diff": "^4.0 || ^5.0 || ^6.0",
|
||||
"symfony/console": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/polyfill-mbstring": "^1.28",
|
||||
"symfony/polyfill-php80": "^1.28",
|
||||
"symfony/polyfill-php81": "^1.28",
|
||||
"symfony/process": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0"
|
||||
"sebastian/diff": "^4.0 || ^5.1 || ^6.0",
|
||||
"symfony/console": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/filesystem": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/finder": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/options-resolver": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/polyfill-mbstring": "^1.31",
|
||||
"symfony/polyfill-php80": "^1.31",
|
||||
"symfony/polyfill-php81": "^1.31",
|
||||
"symfony/process": "^5.4 || ^6.4 || ^7.2",
|
||||
"symfony/stopwatch": "^5.4 || ^6.4 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"facile-it/paraunit": "^1.3.1 || ^2.4",
|
||||
@ -794,9 +794,9 @@
|
||||
"php-cs-fixer/accessible-object": "^1.1",
|
||||
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5",
|
||||
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5",
|
||||
"phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3",
|
||||
"symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8",
|
||||
"symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6"
|
||||
"phpunit/phpunit": "^9.6.22 || ^10.5.40 || ^11.5.2",
|
||||
"symfony/var-dumper": "^5.4.48 || ^6.4.15 || ^7.2.0",
|
||||
"symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dom": "For handling output formats in XML",
|
||||
@ -837,7 +837,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.68.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -845,7 +845,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-25T00:39:24+00:00"
|
||||
"time": "2025-01-17T09:20:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
@ -909,16 +909,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v5.3.1",
|
||||
"version": "v5.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
|
||||
"reference": "447a020a1f875a434d62f2a401f53b82a396e494"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
|
||||
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494",
|
||||
"reference": "447a020a1f875a434d62f2a401f53b82a396e494",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -961,9 +961,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0"
|
||||
},
|
||||
"time": "2024-10-08T18:51:32+00:00"
|
||||
"time": "2024-12-30T11:07:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nulib/tests",
|
||||
@ -1117,16 +1117,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.12.12",
|
||||
"version": "1.12.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0"
|
||||
"reference": "e0bb5cb78545aae631220735aa706eac633a6be9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
|
||||
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e0bb5cb78545aae631220735aa706eac633a6be9",
|
||||
"reference": "e0bb5cb78545aae631220735aa706eac633a6be9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1171,20 +1171,20 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-28T22:13:23+00:00"
|
||||
"time": "2025-01-21T14:50:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-phpunit",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-phpunit.git",
|
||||
"reference": "11d4235fbc6313ecbf93708606edfd3222e44949"
|
||||
"reference": "72a6721c9b64b3e4c9db55abbc38f790b318267e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/11d4235fbc6313ecbf93708606edfd3222e44949",
|
||||
"reference": "11d4235fbc6313ecbf93708606edfd3222e44949",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/72a6721c9b64b3e4c9db55abbc38f790b318267e",
|
||||
"reference": "72a6721c9b64b3e4c9db55abbc38f790b318267e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1221,9 +1221,9 @@
|
||||
"description": "PHPUnit extensions and rules for PHPStan",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan-phpunit/issues",
|
||||
"source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.1"
|
||||
"source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.2"
|
||||
},
|
||||
"time": "2024-11-12T12:43:59+00:00"
|
||||
"time": "2024-12-17T17:20:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@ -1546,16 +1546,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "9.6.21",
|
||||
"version": "9.6.22",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa"
|
||||
"reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa",
|
||||
"reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c",
|
||||
"reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1566,7 +1566,7 @@
|
||||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"myclabs/deep-copy": "^1.12.0",
|
||||
"myclabs/deep-copy": "^1.12.1",
|
||||
"phar-io/manifest": "^2.0.4",
|
||||
"phar-io/version": "^3.2.1",
|
||||
"php": ">=7.3",
|
||||
@ -1629,7 +1629,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1645,7 +1645,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-19T10:50:18+00:00"
|
||||
"time": "2024-12-05T13:48:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@ -1869,33 +1869,33 @@
|
||||
},
|
||||
{
|
||||
"name": "react/child-process",
|
||||
"version": "v0.6.5",
|
||||
"version": "v0.6.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/child-process.git",
|
||||
"reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43"
|
||||
"reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43",
|
||||
"reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43",
|
||||
"url": "https://api.github.com/repos/reactphp/child-process/zipball/1721e2b93d89b745664353b9cfc8f155ba8a6159",
|
||||
"reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
|
||||
"php": ">=5.3.0",
|
||||
"react/event-loop": "^1.2",
|
||||
"react/stream": "^1.2"
|
||||
"react/stream": "^1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35",
|
||||
"react/socket": "^1.8",
|
||||
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
|
||||
"react/socket": "^1.16",
|
||||
"sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"React\\ChildProcess\\": "src"
|
||||
"React\\ChildProcess\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
@ -1932,19 +1932,15 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/reactphp/child-process/issues",
|
||||
"source": "https://github.com/reactphp/child-process/tree/v0.6.5"
|
||||
"source": "https://github.com/reactphp/child-process/tree/v0.6.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/WyriHaximus",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/clue",
|
||||
"type": "github"
|
||||
"url": "https://opencollective.com/reactphp",
|
||||
"type": "open_collective"
|
||||
}
|
||||
],
|
||||
"time": "2022-09-16T13:41:56+00:00"
|
||||
"time": "2025-01-01T16:37:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/dns",
|
||||
@ -3495,12 +3491,12 @@
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/contracts",
|
||||
"name": "symfony/contracts"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -3773,8 +3769,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -3851,8 +3847,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -3935,8 +3931,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -4009,8 +4005,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -4085,8 +4081,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -4165,8 +4161,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -4310,12 +4306,12 @@
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/contracts",
|
||||
"name": "symfony/contracts"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -9,6 +9,9 @@ use nulib\php\func;
|
||||
use nulib\php\nur_func;
|
||||
use nulib\php\time\Date;
|
||||
use nulib\php\time\DateTime;
|
||||
use nulib\ref\ext\spout\ref_builder;
|
||||
use nulib\ref\ext\spout\ref_builder_ods;
|
||||
use nulib\ref\ext\spout\ref_builder_xlsx;
|
||||
use nulib\str;
|
||||
use nulib\web\http;
|
||||
use OpenSpout\Common\Entity\Cell;
|
||||
@ -38,7 +41,7 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
if ($border === null) $border = new Border();
|
||||
$part = new BorderPart($name);
|
||||
if (($color = $params["color"] ?? null) !== null) {
|
||||
$part->setColor(cl::get(ref_params::COLORS, $color, $color));
|
||||
$part->setColor(cl::get(ref_builder::COLORS, $color, $color));
|
||||
}
|
||||
if (($width = $params["width"] ?? null) !== null) $part->setWidth($width);
|
||||
if (($style = $params["style"] ?? null) !== null) $part->setStyle($style);
|
||||
@ -67,10 +70,10 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
if (($name = $font["name"] ?? null) !== null) $style->setFontName($name);
|
||||
if (($size = $font["size"] ?? null) !== null) $style->setFontSize($size);
|
||||
if (($color = $font["color"] ?? null) !== null) {
|
||||
$style->setFontColor(cl::get(ref_params::COLORS, $color, $color));
|
||||
$style->setFontColor(cl::get(ref_builder::COLORS, $color, $color));
|
||||
}
|
||||
if (($color = $cell["bg_color"] ?? null) !== null) {
|
||||
$style->setBackgroundColor(cl::get(ref_params::COLORS, $color, $color));
|
||||
$style->setBackgroundColor(cl::get(ref_builder::COLORS, $color, $color));
|
||||
}
|
||||
if (($align = $cell["align"] ?? null) !== null) $style->setCellAlignment($align);
|
||||
//if (($align = $params["valign"] ?? null) !== null) $style->setCellVerticalAlignment($align);
|
||||
@ -131,7 +134,7 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
const TYPE_DATE = true;
|
||||
|
||||
/** @var array configuration du writer */
|
||||
const WRITER_PARAMS = null;
|
||||
const SPOUT_PARAMS = null;
|
||||
|
||||
/** @var array configuration de la première feuille */
|
||||
const SHEET_PARAMS = null;
|
||||
@ -144,48 +147,48 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
|
||||
function __construct(?string $output, ?array $params=null) {
|
||||
parent::__construct($output, $params);
|
||||
$writerType = $params["ss_type"] ?? null;
|
||||
if ($writerType === null) {
|
||||
$ssType = $params["ss_type"] ?? null;
|
||||
if ($ssType === null) {
|
||||
switch (path::ext($this->output)) {
|
||||
case ".ods":
|
||||
$writerType = self::WRITER_TYPE_ODS;
|
||||
$ssType = self::SS_TYPE_ODS;
|
||||
break;
|
||||
case ".xlsx":
|
||||
default:
|
||||
$writerType = self::WRITER_TYPE_XLSX;
|
||||
$ssType = self::SS_TYPE_XLSX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$writerParams = $params["spout"] ?? static::WRITER_PARAMS;
|
||||
$writerParams["default_column_width"] ??= 10.5;
|
||||
self::ensure_style($writerParams["default_row_style"]);
|
||||
switch ($writerType) {
|
||||
$spoutParams = $params["spout"] ?? static::SPOUT_PARAMS;
|
||||
$spoutParams["default_column_width"] ??= 10.5;
|
||||
self::ensure_style($spoutParams["default_row_style"]);
|
||||
switch ($ssType) {
|
||||
case "ods":
|
||||
case self::WRITER_TYPE_ODS:
|
||||
$writerType = self::WRITER_TYPE_ODS;
|
||||
$writer = WriterEntityFactory::createODSWriter();
|
||||
self::apply_params($writer, $writerParams, ref_params_ods::WRITER);
|
||||
case self::SS_TYPE_ODS:
|
||||
$ssType = self::SS_TYPE_ODS;
|
||||
$ssWriter = WriterEntityFactory::createODSWriter();
|
||||
self::apply_params($ssWriter, $spoutParams, ref_builder_ods::PARAMS_SPOUT);
|
||||
break;
|
||||
case "xlsx":
|
||||
case self::WRITER_TYPE_XLSX:
|
||||
case self::SS_TYPE_XLSX:
|
||||
default:
|
||||
$writerType = self::WRITER_TYPE_XLSX;
|
||||
$writer = WriterEntityFactory::createXLSXWriter();
|
||||
self::apply_params($writer, $writerParams, ref_params_xlsx::WRITER);
|
||||
$ssType = self::SS_TYPE_XLSX;
|
||||
$ssWriter = WriterEntityFactory::createXLSXWriter();
|
||||
self::apply_params($ssWriter, $spoutParams, ref_builder_xlsx::PARAMS_SPOUT);
|
||||
break;
|
||||
}
|
||||
$defaultColumnWidth = $writerParams["default_column_width"] ?? null;
|
||||
if ($defaultColumnWidth !== null) $writer->setDefaultColumnWidth($defaultColumnWidth);
|
||||
$defaultRowHeight = $writerParams["default_row_height"] ?? null;
|
||||
if ($defaultRowHeight !== null) $writer->setDefaultRowHeight($defaultRowHeight);
|
||||
$defaultRowStyle = $writerParams["default_row_style"] ?? null;
|
||||
if ($defaultRowStyle !== null) $writer->setDefaultRowStyle($defaultRowStyle);
|
||||
$writer->writeToStream($this->getResource());
|
||||
$defaultColumnWidth = $spoutParams["default_column_width"] ?? null;
|
||||
if ($defaultColumnWidth !== null) $ssWriter->setDefaultColumnWidth($defaultColumnWidth);
|
||||
$defaultRowHeight = $spoutParams["default_row_height"] ?? null;
|
||||
if ($defaultRowHeight !== null) $ssWriter->setDefaultRowHeight($defaultRowHeight);
|
||||
$defaultRowStyle = $spoutParams["default_row_style"] ?? null;
|
||||
if ($defaultRowStyle !== null) $ssWriter->setDefaultRowStyle($defaultRowStyle);
|
||||
$ssWriter->writeToStream($this->getResource());
|
||||
|
||||
$this->writerType = $writerType;
|
||||
$this->writer = $writer;
|
||||
$this->writerParams = $writerParams;
|
||||
$this->ssType = $ssType;
|
||||
$this->ssWriter = $ssWriter;
|
||||
$this->writerParams = $spoutParams;
|
||||
$this->typeNumeric = boolval($params["type_numeric"] ?? static::TYPE_NUMERIC);
|
||||
$this->typeDate = boolval($params["type_date"] ?? static::TYPE_DATE);
|
||||
|
||||
@ -199,12 +202,12 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
$this->setSheet(null, $sheetParams);
|
||||
}
|
||||
|
||||
const WRITER_TYPE_ODS = 1, WRITER_TYPE_XLSX = 2;
|
||||
const SS_TYPE_ODS = 1, SS_TYPE_XLSX = 2;
|
||||
|
||||
/** @var int type de fichier généré */
|
||||
protected int $writerType;
|
||||
protected int $ssType;
|
||||
|
||||
protected WriterMultiSheetsAbstract $writer;
|
||||
protected WriterMultiSheetsAbstract $ssWriter;
|
||||
|
||||
protected ?array $writerParams;
|
||||
|
||||
@ -248,7 +251,7 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
function setSheet($sheetName, ?array $sheetParams=null): self {
|
||||
if ($sheetName !== null) $sheetParams["->setName"] = $sheetName;
|
||||
|
||||
$writer = $this->writer;
|
||||
$writer = $this->ssWriter;
|
||||
if ($this->firstSheet) {
|
||||
$this->firstSheet = false;
|
||||
$sheet = $writer->getCurrentSheet();
|
||||
@ -259,18 +262,18 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
}
|
||||
$this->rowStyle = self::STYLE_ROW;
|
||||
|
||||
switch ($this->writerType) {
|
||||
case self::WRITER_TYPE_ODS:
|
||||
switch ($this->ssType) {
|
||||
case self::SS_TYPE_ODS:
|
||||
# appliquer les paramètres de la feuille
|
||||
$this->apply_params($sheet, $sheetParams, ref_params_ods::SHEET);
|
||||
$this->apply_params($sheet, $sheetParams, ref_builder_ods::PARAMS_SHEET);
|
||||
break;
|
||||
case self::WRITER_TYPE_XLSX:
|
||||
case self::SS_TYPE_XLSX:
|
||||
# appliquer les paramètres de la feuille
|
||||
$this->apply_params($sheet, $sheetParams, ref_params_xlsx::SHEET);
|
||||
$this->apply_params($sheet, $sheetParams, ref_builder_xlsx::PARAMS_SHEET);
|
||||
# appliquer les paramètres de la vue de la feuille
|
||||
$sheetViewParams =& $sheetParams["view"];
|
||||
$sheetViewParams["->setFreezeRow"] ??= 2;
|
||||
$sheet->setSheetView(self::apply_params(new SheetView(), $sheetViewParams, ref_params_xlsx::SHEET_VIEW));
|
||||
$sheet->setSheetView(self::apply_params(new SheetView(), $sheetViewParams, ref_builder_xlsx::PARAMS_SHEET_VIEW));
|
||||
break;
|
||||
}
|
||||
self::set_defaults($sheetParams, "header_style", [
|
||||
@ -350,7 +353,7 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
function _write(array $row, ?array $colStyles=null, ?array $rowStyle=null): void {
|
||||
$rowParams = null;
|
||||
if ($rowStyle !== null) {
|
||||
foreach (array_keys(ref_params::ROW) as $method) {
|
||||
foreach (array_keys(ref_builder::ROW) as $method) {
|
||||
$value = $rowStyle[$method] ?? null;
|
||||
unset($rowStyle[$method]);
|
||||
if ($value !== null) $rowParams[$method] = $value;
|
||||
@ -389,8 +392,8 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
$rowStyle ??= $oddStyle;
|
||||
self::ensure_style($rowStyle);
|
||||
$row = WriterEntityFactory::createRow($cells, $rowStyle);
|
||||
self::apply_params($row, $rowParams, ref_params::ROW);
|
||||
$this->writer->addRow($row);
|
||||
self::apply_params($row, $rowParams, ref_builder::ROW);
|
||||
$this->ssWriter->addRow($row);
|
||||
if ($differentOddEven) $this->oddEvenIndex++;
|
||||
}
|
||||
|
||||
@ -414,7 +417,7 @@ class SpoutBuilder extends AbstractBuilder {
|
||||
}
|
||||
|
||||
protected function _checkOk(): bool {
|
||||
$this->writer->close();
|
||||
$this->ssWriter->close();
|
||||
$this->rewind();
|
||||
return true;
|
||||
}
|
@ -1,13 +1,31 @@
|
||||
<?php
|
||||
namespace nulib\ext\spout;
|
||||
namespace nulib\ref\ext\spout;
|
||||
|
||||
use OpenSpout\Common\Entity\Style\Color;
|
||||
|
||||
class ref_params {
|
||||
const READER = [
|
||||
class ref_builder {
|
||||
const PARAMS = [
|
||||
# Builder
|
||||
"output" => "?string",
|
||||
"schema" => "?array",
|
||||
"headers" => "?array",
|
||||
"use_headers" => "bool",
|
||||
"rows" => "?array",
|
||||
"cook_func" => "?callable",
|
||||
"ss_type" => "?string",
|
||||
# SpoutBuilder
|
||||
"type_numeric" => "bool",
|
||||
"type_date" => "bool",
|
||||
"spout" => self::PARAMS_SPOUT,
|
||||
"sheet" => self::PARAMS_SHEET,
|
||||
"sheet_name" => "?string",
|
||||
"sheet_view" => self::PARAMS_SHEET_VIEW,
|
||||
# TempStream
|
||||
"max_memory" => "?int",
|
||||
"throw_on_error" => "?bool",
|
||||
];
|
||||
|
||||
const WRITER = [
|
||||
const PARAMS_SPOUT = [
|
||||
"->setColumnWidth" => ["float", ["int", null]],
|
||||
"->setColumnWidthForRange" => ["int", "int", "int"],
|
||||
"default_column_width" => "float",
|
||||
@ -15,7 +33,8 @@ class ref_params {
|
||||
"default_row_style" => self::STYLE,
|
||||
];
|
||||
|
||||
const SHEET = [
|
||||
const PARAMS_SHEET = [
|
||||
"view" => self::PARAMS_SHEET_VIEW,
|
||||
"->setName" => ["string"],
|
||||
"->setIsVisible" => ["bool"],
|
||||
"header_style" => self::STYLE,
|
||||
@ -24,6 +43,8 @@ class ref_params {
|
||||
"different_odd_even" => "bool",
|
||||
];
|
||||
|
||||
const PARAMS_SHEET_VIEW = [];
|
||||
|
||||
const ROW = [
|
||||
"->setHeight" => ["float"],
|
||||
];
|
5
src/ref/ext/spout/ref_builder_ods.php
Normal file
5
src/ref/ext/spout/ref_builder_ods.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
namespace nulib\ref\ext\spout;
|
||||
|
||||
class ref_builder_ods extends ref_builder {
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace nulib\ext\spout;
|
||||
namespace nulib\ref\ext\spout;
|
||||
|
||||
class ref_params_xlsx extends ref_params {
|
||||
const SHEET = [
|
||||
"view" => self::SHEET_VIEW,
|
||||
class ref_builder_xlsx extends ref_builder {
|
||||
const PARAMS_SHEET = [
|
||||
"view" => self::PARAMS_SHEET_VIEW,
|
||||
# copie de parent::SHEET
|
||||
"->setName" => ["string"],
|
||||
"->setIsVisible" => ["bool"],
|
||||
@ -13,7 +13,7 @@ class ref_params_xlsx extends ref_params {
|
||||
"different_odd_even" => "bool",
|
||||
];
|
||||
|
||||
const SHEET_VIEW = [
|
||||
const PARAMS_SHEET_VIEW = [
|
||||
"->setFreezeRow" => ["int"],
|
||||
"->setFreezeColumn" => ["string"],
|
||||
"->setZoomScale" => ["int"],
|
||||
@ -31,5 +31,6 @@ class ref_params_xlsx extends ref_params {
|
||||
"->setZoomScaleNormal" => ["int"],
|
||||
"->setZoomScalePageLayoutView" => ["int"],
|
||||
"->setWorkbookViewId" => ["int"],
|
||||
# copie de parent::PARAMS_SHEET_VIEW
|
||||
];
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
namespace nulib\ext\spout;
|
||||
|
||||
class ref_params_ods extends ref_params {
|
||||
}
|
Loading…
Reference in New Issue
Block a user