diff --git a/src/Drivers/PhpSpreadsheetDriver.php b/src/Drivers/PhpSpreadsheetDriver.php
index ea27f81..8887d63 100644
--- a/src/Drivers/PhpSpreadsheetDriver.php
+++ b/src/Drivers/PhpSpreadsheetDriver.php
@@ -8,6 +8,8 @@
class PhpSpreadsheetDriver implements SheetsInterface, GridInterface, MixInterface
{
+ use \AnourValar\Office\Traits\Parser;
+
/**
* @var string
*/
@@ -526,8 +528,8 @@ public function duplicateRows(string $ceilRange, callable $value, int $indentRow
if (
$item[0][1] >= $range[0][1] && $item[0][1] <= $range[1][1] // rows
&& $item[1][1] >= $range[0][1] && $item[1][1] <= $range[1][1]
- && $item[0][0] >= $range[0][0] && $item[0][0] <= $range[1][0] // columns
- && $item[1][0] >= $range[0][0] && $item[1][0] <= $range[1][0]
+ && $this->isColumnGE($item[0][0], $range[0][0]) && $this->isColumnLE($item[0][0], $range[1][0]) // columns
+ && $this->isColumnGE($item[1][0], $range[0][0]) && $this->isColumnLE($item[1][0], $range[1][0])
) {
$this->mergeCells($item[0][0].($item[0][1]+$shift) . ':' . $item[1][0].($item[1][1]+$shift));
}
@@ -540,7 +542,7 @@ public function duplicateRows(string $ceilRange, callable $value, int $indentRow
// Style, CellFormat, Value
$column = $range[0][0];
- while ($column <= $range[1][0]) {
+ while ($this->isColumnLE($column, $range[1][0])) {
$this->copyStyle($column . $curr, $column . ($curr + $shift));
$this->copyCellFormat($column . $curr, $column . ($curr + $shift));
diff --git a/src/Drivers/ZipDriver.php b/src/Drivers/ZipDriver.php
index ab8fa8c..302841e 100644
--- a/src/Drivers/ZipDriver.php
+++ b/src/Drivers/ZipDriver.php
@@ -4,6 +4,7 @@
class ZipDriver implements DocumentInterface, GridInterface
{
+ use \Anourvalar\Office\Traits\Parser;
use \AnourValar\Office\Traits\XFormat;
/**
@@ -192,7 +193,7 @@ public function setGrid(iterable $data): self
if ($value === null || $value === '') {
- if ($column >= $firstColumn) {
+ if ($this->isColumnGE($column, $firstColumn)) {
$sheet .= '';
}
@@ -239,7 +240,7 @@ public function setGrid(iterable $data): self
// Columns
$column = 'A';
for ($index = 1; $index <= $columnsCount; $index++) {
- if ($column >= $firstColumn) {
+ if ($this->isColumnGE($column, $firstColumn)) {
$width = ($this->gridOptions['width'][$column] ?? 20);
$cols .= '
';
}
diff --git a/src/GridService.php b/src/GridService.php
index 3badfd1..7b6eb13 100644
--- a/src/GridService.php
+++ b/src/GridService.php
@@ -6,6 +6,8 @@
class GridService
{
+ use \AnourValar\Office\Traits\Parser;
+
/**
* @var \AnourValar\Office\Drivers\GridInterface
*/
@@ -198,7 +200,7 @@ protected function getGenerator(
// left top corner: column
$firstColumn = 'A';
$indent = [];
- while ($firstColumn < $ltc[0]) {
+ while ($this->isColumnLE($firstColumn, $ltc[0]) && $firstColumn != $ltc[0]) {
$firstColumn++;
$indent[] = '';
}
@@ -285,7 +287,7 @@ protected function getGenerator(
if ($totalRange) {
$keys = array_keys($headers);
- while ($firstColumn <= $lastColumn) {
+ while ($this->isColumnLE($firstColumn, $lastColumn)) {
if (! $keys) {
$columns[] = $firstColumn;
} else {
diff --git a/src/Sheets/Parser.php b/src/Sheets/Parser.php
index 235e41e..21c7d57 100644
--- a/src/Sheets/Parser.php
+++ b/src/Sheets/Parser.php
@@ -34,7 +34,7 @@ public function schema(array $values, array $data, array $mergeCells): SchemaMap
$schema = new SchemaMapper();
// Step 0: Parse input arguments to a canon format
- $values = $this->parseValues($values);
+ $values = $this->parseValues($values, $lastColumn);
$data = $this->parseData($data);
$mergeCells = $this->parseMergeCells($mergeCells);
@@ -42,7 +42,7 @@ public function schema(array $values, array $data, array $mergeCells): SchemaMap
$this->canonizeMarkers($values, $data);
// Step 2: Calculate additional rows & columns, redundant data
- $dataSchema = $this->calculateDataSchema($values, $data, $mergeCells, $schema);
+ $dataSchema = $this->calculateDataSchema($values, $data, $mergeCells, $schema, $lastColumn);
// Step 3: Shift formulas
$this->shiftFormulas($dataSchema, $schema, $mergeCells);
@@ -55,11 +55,21 @@ public function schema(array $values, array $data, array $mergeCells): SchemaMap
/**
* @param array $values
+ * @param mixed $lastColumn
* @return array
*/
- protected function parseValues(array $values): array
+ protected function parseValues(array $values, &$lastColumn): array
{
- ksort($values); // just in case ;)
+ $lastColumn = 'A';
+ foreach ($values as $row => &$columns) {
+ $currLastColumn = array_key_last($columns);
+ if ($this->isColumnLE($lastColumn, $currLastColumn)) {
+ $lastColumn = $currLastColumn;
+ }
+
+ $columns = array_filter($columns, fn ($item) => $item !== null && $item !== '');
+ }
+ unset($columns);
return $values;
}
@@ -167,10 +177,15 @@ function ($patterns) use ($data) {
* @param array $data
* @param array $mergeCells
* @param \AnourValar\Office\Sheets\SchemaMapper $schema
+ * @param string $lastColumn
* @return array
*/
- protected function calculateDataSchema(array &$values, array &$data, array &$mergeCells, SchemaMapper &$schema): array
- {
+ protected function calculateDataSchema(
+ array &$values, array &$data,
+ array &$mergeCells,
+ SchemaMapper &$schema,
+ string $lastColumn
+ ): array {
$dataSchema = [];
$shift = 0;
$step = 0;
@@ -260,7 +275,7 @@ protected function calculateDataSchema(array &$values, array &$data, array &$mer
$mergeMapX = [];
foreach ($mergeCells as $item) {
if ($additionColumn.($row + $shift) == $item[0][0].$item[0][1] && $item[0][1] == $item[1][1]) {
- while ($item[0][0] < $item[1][0]) {
+ while ($this->isColumnLE($item[0][0], $item[1][0]) && $item[0][0] != $item[1][0]) {
$item[0][0]++;
$mergeMapX[] = $item[0][0];
}
@@ -278,7 +293,6 @@ protected function calculateDataSchema(array &$values, array &$data, array &$mer
$additionColumnValue = $this->increments($additionColumnValue, false);
$columns[$curr] = $additionColumnValue;
$schema->copyStyle($additionColumn.($row + $shift), $curr.($row + $shift));
- $schema->copyCellFormat($additionColumn.($row + $shift), $curr.($row + $shift));
$schema->copyWidth($additionColumn, $curr);
if ($mergeMapX) {
@@ -294,10 +308,20 @@ protected function calculateDataSchema(array &$values, array &$data, array &$mer
}
}
- $dataSchema[$row + $shift] = array_filter($columns, fn ($item) => $item !== null && $item !== '');
+ $dataSchema[$row + $shift] = $columns;
$originalRow = ($row + $shift);
if ($additionRows) {
+ $firstColumn = 'A';
+ while ($this->isColumnLE($firstColumn, $lastColumn)) {
+ if (! isset($columns[$firstColumn]) && ! $this->insideMerge($firstColumn, $originalRow, $mergeCells)) {
+ $columns[$firstColumn] = null;
+ }
+
+ $firstColumn++;
+ }
+ uksort($columns, fn ($a, $b) => $this->isColumnLE($a, $b) ? -1 : 1);
+
foreach ($columns as $currKey => $currValue) {
$hasMarker = preg_match('#\[([a-z][a-z\d\.\_]+)\]#iS', (string) $currValue);
@@ -335,7 +359,6 @@ protected function calculateDataSchema(array &$values, array &$data, array &$mer
foreach (array_keys($columns) as $curr) {
$schema->copyStyle($curr.$originalRow, $curr.($row + $shift));
- $schema->copyCellFormat($curr.$originalRow, $curr.($row + $shift));
foreach ($mergeCells as $item) {
if ($curr.$originalRow == $item[0][0].$item[0][1]) {
@@ -755,4 +778,27 @@ private function deleteRow(SchemaMapper &$schema, array &$mergeCells, int $row):
}
unset($mergeCell);
}
+
+ /**
+ * @param string $column
+ * @param int $row
+ * @param array $mergeCells
+ * @return bool
+ */
+ private function insideMerge(string $column, int $row, array &$mergeCells): bool
+ {
+ foreach ($mergeCells as $item) {
+ if (
+ $this->isColumnLE($item[0][0], $column)
+ && $this->isColumnGE($item[1][0], $column)
+ && $item[0][1] <= $row
+ && $item[1][1] >= $row
+ && ($item[0][0] != $column || $item[0][1] != $row)
+ ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
diff --git a/src/Sheets/SchemaMapper.php b/src/Sheets/SchemaMapper.php
index b1de83c..801fc94 100644
--- a/src/Sheets/SchemaMapper.php
+++ b/src/Sheets/SchemaMapper.php
@@ -17,8 +17,6 @@ class SchemaMapper
'merge_cells' => [], //[ 'A1:B1', 'C1:D1']
'copy_width' => [], //[ ['from' => 'B', 'to' => 'C'] ]
-
- 'copy_cell_format' => [], //[ ['from' => 'A1', 'to' => 'A2'] ]
];
/**
@@ -34,8 +32,6 @@ public function toArray(): array
sort($this->payload['copy_width']);
- $this->normalizeCells($this->payload['copy_cell_format']);
-
return $this->payload;
}
@@ -117,18 +113,6 @@ public function copyWidth(string $from, string $to): self
return $this;
}
- /**
- * @param string $from
- * @param string $to
- * @return self
- */
- public function copyCellFormat(string $from, string $to): self
- {
- $this->payload['copy_cell_format'][$from.$to] = ['from' => $from, 'to' => $to];
-
- return $this;
- }
-
/**
* @param array $rows
* @return void
diff --git a/src/SheetsService.php b/src/SheetsService.php
index 4da69a4..5cfd043 100644
--- a/src/SheetsService.php
+++ b/src/SheetsService.php
@@ -179,9 +179,13 @@ protected function handleSheet(SheetsInterface &$driver, array &$data, int $shee
}
}
- // Copy style
+ // Copy style & cell format
foreach ($schema['copy_style'] as $item) {
$driver->copyStyle($item['from'], $item['to']);
+
+ if (! $autoCellFormat) {
+ $driver->copyCellFormat($item['from'], $item['to']);
+ }
}
// Merge cells
@@ -194,13 +198,6 @@ protected function handleSheet(SheetsInterface &$driver, array &$data, int $shee
$driver->copyWidth($item['from'], $item['to']);
}
- // Copy cell format
- if (! $autoCellFormat) {
- foreach ($schema['copy_cell_format'] as $item) {
- $driver->copyCellFormat($item['from'], $item['to']);
- }
- }
-
// Data
$driver->setValues($this->handleData($schema['data'], $driver, $sheetIndex), $autoCellFormat);
}
diff --git a/src/Traits/Parser.php b/src/Traits/Parser.php
index c45d426..7c89c01 100644
--- a/src/Traits/Parser.php
+++ b/src/Traits/Parser.php
@@ -23,4 +23,46 @@ protected function dot(array $data, string $prefix = ''): array
return $result;
}
+
+ /**
+ * @param string $compareColumn
+ * @param string $referenceColumn
+ * @return bool
+ */
+ protected function isColumnLE(string $compareColumn, string $referenceColumn): bool
+ {
+ $compareLength = strlen($compareColumn);
+ $referenceLength = strlen($referenceColumn);
+
+ if ($compareLength < $referenceLength) {
+ return true;
+ }
+
+ if ($compareLength > $referenceLength) {
+ return false;
+ }
+
+ return $compareColumn <= $referenceColumn;
+ }
+
+ /**
+ * @param string $compareColumn
+ * @param string $referenceColumn
+ * @return bool
+ */
+ protected function isColumnGE(string $compareColumn, string $referenceColumn): bool
+ {
+ $compareLength = strlen($compareColumn);
+ $referenceLength = strlen($referenceColumn);
+
+ if ($compareLength > $referenceLength) {
+ return true;
+ }
+
+ if ($compareLength < $referenceLength) {
+ return false;
+ }
+
+ return $compareColumn >= $referenceColumn;
+ }
}
diff --git a/tests/SheetsParserTest.php b/tests/SheetsParserTest.php
index 3b8da22..26ba8ff 100644
--- a/tests/SheetsParserTest.php
+++ b/tests/SheetsParserTest.php
@@ -132,8 +132,6 @@ public function test_collision_names()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -174,19 +172,24 @@ public function test_schema_scalar()
'H' => '[hello]',
'J' => '[world]',
'K' => '[k] [9] [9k] [k9]',
+ 'Y' => null,
],
'3' => [
'D' => '[bar] [!bar]',
+ 'Y' => null,
],
'4' => [
'D' => 'hello world',
+ 'Y' => null,
],
'5' => [
'A' => 1,
'B' => 2,
+ 'Y' => null,
],
'6' => [
'Q' => '=A1+B2+C3+D4+E5',
+ 'Y' => null,
],
],
@@ -240,8 +243,6 @@ public function test_schema_scalar()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -263,15 +264,19 @@ public function test_schema_not_scalar()
],
2 => [
'A' => 'hello [bar] world',
+ 'B' => null,
],
3 => [
'A' => '[test] [=foo]',
+ 'B' => null,
],
4 => [
'A' => '[test2] [=bar]',
+ 'B' => null,
],
5 => [
'A' => '[test2] [!foo]',
+ 'B' => null,
],
],
@@ -310,8 +315,6 @@ public function test_schema_not_scalar()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -333,8 +336,6 @@ public function test_schema_not_scalar()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema([1 => ['A' => 'hello [world]']], ['world' => function () {}], [])->toArray()
);
@@ -395,8 +396,6 @@ public function test_schema_conditions1()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -473,8 +472,6 @@ public function test_schema_conditions2()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -493,18 +490,22 @@ public function test_schema_list_zero_empty()
1 => [
'A' => 'foo',
'B' => '[foo] [=test]',
+ 'C' => null,
],
2 => [
'A' => 'foo',
'B' => '[foo] [= list]',
+ 'C' => null,
],
3 => [
'A' => 'bar [= bar]',
'B' => '[bar] 111',
+ 'C' => null,
],
4 => [
'A' => 'foo [= list.0]',
'B' => '[foo]',
+ 'C' => null,
],
5 => [
'A' => 'bar',
@@ -514,10 +515,12 @@ public function test_schema_list_zero_empty()
6 => [
'A' => 'foo [= list.0.c]',
'B' => '[foo] [!list]',
+ 'C' => null,
],
7 => [
'A' => 'bar',
'B' => '[bar] 333 [! list]',
+ 'C' => null,
],
],
@@ -558,8 +561,6 @@ public function test_schema_list_zero_empty()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"#$id"
@@ -578,6 +579,7 @@ public function test_schema_list_zero()
1 => [
'A' => 'foo [= list.0.c]',
'B' => '[foo]',
+ 'K' => null,
],
2 => [
'A' => 'foo',
@@ -596,6 +598,7 @@ public function test_schema_list_zero()
'A' => 'bar',
'B' => '[bar]',
'I' => '=A1*B2*C3',
+ 'K' => null,
],
],
@@ -611,6 +614,7 @@ public function test_schema_list_zero()
1 => [
'A' => 'foo',
'B' => '[foo] [=list_c.0]',
+ 'K' => null,
],
2 => [
'A' => 'foo',
@@ -629,6 +633,7 @@ public function test_schema_list_zero()
'A' => 'bar',
'B' => '[bar]',
'I' => '=A1*B2*C3',
+ 'K' => null,
],
],
@@ -670,8 +675,6 @@ public function test_schema_list_zero()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"#$id"
@@ -705,6 +708,7 @@ public function test_schema_list_one()
'F' => 'bar',
'G' => '[bar]',
'H' => '=A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -715,6 +719,7 @@ public function test_schema_list_one()
],
4 => [
'A' => '[bar] [! list]',
+ 'K' => null,
],
],
@@ -745,6 +750,7 @@ public function test_schema_list_one()
'F' => 'bar',
'G' => '[bar]',
'H' => '=A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -755,6 +761,7 @@ public function test_schema_list_one()
],
4 => [
'A' => '[bar] [!list]',
+ 'K' => null,
],
],
@@ -785,6 +792,7 @@ public function test_schema_list_one()
'F' => 'bar',
'G' => '[bar]',
'H' => '=A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -795,6 +803,7 @@ public function test_schema_list_one()
],
4 => [
'A' => '[bar] [! list_c]',
+ 'K' => null,
],
],
@@ -826,6 +835,7 @@ public function test_schema_list_one()
'F' => 'bar',
'G' => '[bar]',
'H' => '=A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -836,6 +846,7 @@ public function test_schema_list_one()
],
4 => [
'A' => '[bar] [!list_c]',
+ 'K' => null,
],
],
@@ -879,8 +890,6 @@ public function test_schema_list_one()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -915,6 +924,7 @@ public function test_schema_list_two()
'G' => '[bar]',
'H' => '=A1*B2*C3',
'J' => 'A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -953,6 +963,7 @@ public function test_schema_list_two()
'G' => '[bar]',
'H' => '=A1*B2*C3',
'J' => 'A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -991,6 +1002,7 @@ public function test_schema_list_two()
'G' => '[bar]',
'H' => '=A1*B2*C3',
'J' => 'A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1030,6 +1042,7 @@ public function test_schema_list_two()
'G' => '[bar]',
'H' => '=A1*B2*C3',
'J' => 'A1*B2*C3',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1100,24 +1113,14 @@ public function test_schema_list_two()
['from' => 'F2', 'to' => 'F3'],
['from' => 'G2', 'to' => 'G3'],
['from' => 'H2', 'to' => 'H3'],
+ ['from' => 'I2', 'to' => 'I3'],
['from' => 'J2', 'to' => 'J3'],
+ ['from' => 'K2', 'to' => 'K3'],
],
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3'],
- ['from' => 'B2', 'to' => 'B3'],
- ['from' => 'C2', 'to' => 'C3'],
- ['from' => 'D2', 'to' => 'D3'],
- ['from' => 'E2', 'to' => 'E3'],
- ['from' => 'F2', 'to' => 'F3'],
- ['from' => 'G2', 'to' => 'G3'],
- ['from' => 'H2', 'to' => 'H3'],
- ['from' => 'J2', 'to' => 'J3'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -1150,6 +1153,7 @@ public function test_schema_list_three()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1187,6 +1191,7 @@ public function test_schema_list_three()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1224,6 +1229,7 @@ public function test_schema_list_three()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1262,6 +1268,7 @@ public function test_schema_list_three()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1341,22 +1348,13 @@ public function test_schema_list_three()
['from' => 'G2', 'to' => 'G3:G4'],
['from' => 'H2', 'to' => 'H3:H4'],
['from' => 'I2', 'to' => 'I3:I4'],
+ ['from' => 'J2', 'to' => 'J3:J4'],
+ ['from' => 'K2', 'to' => 'K3:K4'],
],
'merge_cells' => ['E3:F3', 'E4:F4'],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'B2', 'to' => 'B3:B4'],
- ['from' => 'C2', 'to' => 'C3:C4'],
- ['from' => 'D2', 'to' => 'D3:D4'],
- ['from' => 'E2', 'to' => 'E3:E4'],
- ['from' => 'G2', 'to' => 'G3:G4'],
- ['from' => 'H2', 'to' => 'H3:H4'],
- ['from' => 'I2', 'to' => 'I3:I4'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -1375,6 +1373,7 @@ public function test_schema_list_three_limit()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'G' => null,
],
2 => [
'A' => 'foo',
@@ -1390,6 +1389,7 @@ public function test_schema_list_three_limit()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'G' => null,
],
],
@@ -1405,6 +1405,7 @@ public function test_schema_list_three_limit()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'G' => null,
],
2 => [
'A' => 'foo',
@@ -1420,6 +1421,7 @@ public function test_schema_list_three_limit()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'G' => null,
],
],
@@ -1459,8 +1461,6 @@ public function test_schema_list_three_limit()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -1493,6 +1493,7 @@ public function test_schema_list_four()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1530,6 +1531,7 @@ public function test_schema_list_four()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1567,6 +1569,7 @@ public function test_schema_list_four()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1605,6 +1608,7 @@ public function test_schema_list_four()
'G' => 'bar',
'H' => '[bar]',
'I' => '=A2*C2+B1+D3+E$2',
+ 'K' => null,
],
3 => [
'A' => 'bar',
@@ -1694,22 +1698,13 @@ public function test_schema_list_four()
['from' => 'G2', 'to' => 'G3:G5'],
['from' => 'H2', 'to' => 'H3:H5'],
['from' => 'I2', 'to' => 'I3:I5'],
+ ['from' => 'J2', 'to' => 'J3:J5'],
+ ['from' => 'K2', 'to' => 'K3:K5'],
],
'merge_cells' => ['E3:F3', 'E4:F4', 'E5:F5'],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A5'],
- ['from' => 'B2', 'to' => 'B3:B5'],
- ['from' => 'C2', 'to' => 'C3:C5'],
- ['from' => 'D2', 'to' => 'D3:D5'],
- ['from' => 'E2', 'to' => 'E3:E5'],
- ['from' => 'G2', 'to' => 'G3:G5'],
- ['from' => 'H2', 'to' => 'H3:H5'],
- ['from' => 'I2', 'to' => 'I3:I5'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -1739,10 +1734,12 @@ public function test_schema_matrix_zero_empty()
3 => [
'A' => 'bar [= test]',
'B' => '[foo]',
+ 'C' => null,
],
4 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -1769,10 +1766,12 @@ public function test_schema_matrix_zero_empty()
3 => [
'A' => 'bar',
'B' => '[foo] [= test]',
+ 'C' => null,
],
4 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -1807,8 +1806,6 @@ public function test_schema_matrix_zero_empty()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"#$id"
@@ -1838,6 +1835,7 @@ public function test_schema_matrix_zero()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -1864,6 +1862,7 @@ public function test_schema_matrix_zero()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -1890,6 +1889,7 @@ public function test_schema_matrix_zero()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -1916,6 +1916,7 @@ public function test_schema_matrix_zero()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -1951,8 +1952,6 @@ public function test_schema_matrix_zero()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"#$id"
@@ -1982,6 +1981,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2008,6 +2008,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2034,6 +2035,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2060,6 +2062,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2086,6 +2089,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2112,6 +2116,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2138,6 +2143,7 @@ public function test_schema_matrix_one()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2173,8 +2179,6 @@ public function test_schema_matrix_one()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2204,6 +2208,7 @@ public function test_schema_matrix_two()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2230,6 +2235,7 @@ public function test_schema_matrix_two()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2256,6 +2262,7 @@ public function test_schema_matrix_two()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2282,6 +2289,7 @@ public function test_schema_matrix_two()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2320,10 +2328,6 @@ public function test_schema_matrix_two()
'merge_cells' => [],
'copy_width' => [['from' => 'C', 'to' => 'D']],
-
- 'copy_cell_format' => [
- ['from' => 'C2', 'to' => 'D2'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2342,6 +2346,7 @@ public function test_schema_matrix_two_limit()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'C' => null,
],
2 => [
'A' => 'foo',
@@ -2352,6 +2357,7 @@ public function test_schema_matrix_two_limit()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2367,6 +2373,7 @@ public function test_schema_matrix_two_limit()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'C' => null,
],
2 => [
'A' => 'foo',
@@ -2377,6 +2384,7 @@ public function test_schema_matrix_two_limit()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2411,8 +2419,6 @@ public function test_schema_matrix_two_limit()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2442,6 +2448,7 @@ public function test_schema_matrix_three()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2468,6 +2475,7 @@ public function test_schema_matrix_three()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2494,6 +2502,7 @@ public function test_schema_matrix_three()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2520,6 +2529,7 @@ public function test_schema_matrix_three()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'C' => null,
],
],
@@ -2563,11 +2573,6 @@ public function test_schema_matrix_three()
['from' => 'C', 'to' => 'D'],
['from' => 'C', 'to' => 'E'],
],
-
- 'copy_cell_format' => [
- ['from' => 'C2', 'to' => 'D2'],
- ['from' => 'C2', 'to' => 'E2'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2587,11 +2592,13 @@ public function test_schema_multi_equal()
'A' => 'foo',
'B' => '[foo]',
'C' => '=SUM(A2:A2)',
+ 'D' => null,
],
2 => [
'A' => 'foo',
'B' => '[matrix.b]',
'C' => '[matrix.c]',
+ 'D' => null,
],
3 => [
'A' => 'bar',
@@ -2618,11 +2625,13 @@ public function test_schema_multi_equal()
'A' => 'foo',
'B' => '[foo]',
'C' => '=SUM(A2:A2)',
+ 'D' => null,
],
2 => [
'A' => 'foo',
'B' => '[matrix.*.b]',
'C' => '[matrix.*.c]',
+ 'D' => null,
],
3 => [
'A' => 'bar',
@@ -2649,11 +2658,13 @@ public function test_schema_multi_equal()
'A' => 'foo',
'B' => '[foo]',
'C' => '=SUM(A2:A2)',
+ 'D' => null,
],
2 => [
'A' => 'foo',
'B' => '[matrix.*.b]',
'C' => '[matrix.*.c]',
+ 'D' => null,
],
3 => [
'A' => 'bar',
@@ -2731,16 +2742,6 @@ public function test_schema_multi_equal()
['from' => 'C', 'to' => 'D'],
['from' => 'C', 'to' => 'E'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'B2', 'to' => 'B3:B4'],
- ['from' => 'C2', 'to' => 'C3:C4'],
- ['from' => 'C2', 'to' => 'D2'],
- ['from' => 'C2', 'to' => 'E2'],
- ['from' => 'D2', 'to' => 'D3:D4'],
- ['from' => 'E2', 'to' => 'E3:E4'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2759,11 +2760,13 @@ public function test_schema_multi_equal_limit()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'D' => null,
],
2 => [
'A' => 'foo',
'B' => '[matrix.0.b]',
'C' => '[matrix.0.c.0]',
+ 'D' => null,
],
3 => [
'A' => 'bar',
@@ -2810,8 +2813,6 @@ public function test_schema_multi_equal_limit()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2830,11 +2831,13 @@ public function test_schema_multi_irr()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'D' => null,
],
2 => [
'A' => 'foo',
'B' => '[matrix.0.b] [= matrix.0.b]',
'C' => '[matrix.0.c.0] [=matrix.c]',
+ 'D' => null,
],
3 => [
'A' => 'bar',
@@ -2860,11 +2863,13 @@ public function test_schema_multi_irr()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'D' => null,
],
2 => [
'A' => 'foo',
'B' => '[matrix.b]',
'C' => '[matrix.c]',
+ 'D' => null,
],
3 => [
'A' => 'bar',
@@ -2941,16 +2946,6 @@ public function test_schema_multi_irr()
['from' => 'C', 'to' => 'D'],
['from' => 'C', 'to' => 'E'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'B2', 'to' => 'B3:B4'],
- ['from' => 'C2', 'to' => 'C3:C4'],
- ['from' => 'C2', 'to' => 'D2'],
- ['from' => 'C2', 'to' => 'E2'],
- ['from' => 'D2', 'to' => 'D3:D4'],
- ['from' => 'E2', 'to' => 'E3:E4'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -2969,6 +2964,7 @@ public function test_schema_multi_combination1()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'E' => null,
],
2 => [
'A' => 'foo',
@@ -2979,6 +2975,7 @@ public function test_schema_multi_combination1()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'E' => null,
],
],
@@ -3002,6 +2999,7 @@ public function test_schema_multi_combination1()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'E' => null,
],
2 => [
'A' => 'foo',
@@ -3012,6 +3010,7 @@ public function test_schema_multi_combination1()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'E' => null,
],
],
@@ -3075,6 +3074,7 @@ public function test_schema_multi_combination1()
['from' => 'A2', 'to' => 'A3:A4'],
['from' => 'B2', 'to' => 'B3:B4'],
['from' => 'C2', 'to' => 'C3:C4'],
+ ['from' => 'D2', 'to' => 'D3:D4'],
['from' => 'E2', 'to' => 'E3:E4'],
['from' => 'E2', 'to' => 'F2'],
['from' => 'E2', 'to' => 'G2'],
@@ -3088,17 +3088,6 @@ public function test_schema_multi_combination1()
['from' => 'E', 'to' => 'F'],
['from' => 'E', 'to' => 'G'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'B2', 'to' => 'B3:B4'],
- ['from' => 'C2', 'to' => 'C3:C4'],
- ['from' => 'E2', 'to' => 'E3:E4'],
- ['from' => 'E2', 'to' => 'F2'],
- ['from' => 'E2', 'to' => 'G2'],
- ['from' => 'F2', 'to' => 'F3:F4'],
- ['from' => 'G2', 'to' => 'G3:G4'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -3117,6 +3106,7 @@ public function test_schema_multi_combination1_limit()
1 => [
'A' => 'foo',
'B' => '[foo]',
+ 'E' => null,
],
2 => [
'A' => 'foo',
@@ -3127,6 +3117,7 @@ public function test_schema_multi_combination1_limit()
3 => [
'A' => 'bar',
'B' => '[bar]',
+ 'E' => null,
],
],
@@ -3170,8 +3161,6 @@ public function test_schema_multi_combination1_limit()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -3201,6 +3190,7 @@ public function test_schema_multi_combination2()
],
3 => [
'A' => '[foo]',
+ 'E' => null,
],
],
@@ -3237,6 +3227,7 @@ public function test_schema_multi_combination2()
],
3 => [
'A' => '[foo]',
+ 'E' => null,
],
],
@@ -3313,19 +3304,6 @@ public function test_schema_multi_combination2()
['from' => 'E', 'to' => 'F'],
['from' => 'E', 'to' => 'G'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3'],
- ['from' => 'B2', 'to' => 'B3'],
- ['from' => 'C2', 'to' => 'C3'],
- ['from' => 'E1', 'to' => 'F1'],
- ['from' => 'E1', 'to' => 'G1'],
- ['from' => 'E2', 'to' => 'E3'],
- ['from' => 'E2', 'to' => 'F2'],
- ['from' => 'E2', 'to' => 'G2'],
- ['from' => 'F2', 'to' => 'F3'],
- ['from' => 'G2', 'to' => 'G3'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -3354,6 +3332,7 @@ public function test_schema_multi_combination2_limit()
],
3 => [
'A' => '[foo]',
+ 'E' => null,
],
],
@@ -3411,13 +3390,6 @@ public function test_schema_multi_combination2_limit()
['from' => 'E', 'to' => 'F'],
['from' => 'E', 'to' => 'G'],
],
-
- 'copy_cell_format' => [
- ['from' => 'E1', 'to' => 'F1'],
- ['from' => 'E1', 'to' => 'G1'],
- ['from' => 'E2', 'to' => 'F2'],
- ['from' => 'E2', 'to' => 'G2'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -3437,9 +3409,11 @@ public function test_schema_multi_combination3()
'B' => '[title] [=column.month]',
'C' => '=D6 [oops]',
'D' => 'D6',
+ 'Q' => null,
],
3 => [
'G' => '[column.month] [= column.month]',
+ 'Q' => null,
],
4 => [
'A' => '[list.name]',
@@ -3452,10 +3426,12 @@ public function test_schema_multi_combination3()
],
6 => [
'B' => '[total.count]',
+ 'Q' => null,
],
7 => [
'C' => '=D6 [oops]',
'D' => 'D6',
+ 'Q' => null,
],
],
@@ -3484,9 +3460,11 @@ public function test_schema_multi_combination3()
'B' => '[title] [=column.*.month]',
'C' => '=D6',
'D' => 'D6',
+ 'Q' => null,
],
3 => [
'G' => '[column.*.month] [= column.*.month.*]',
+ 'Q' => null,
],
4 => [
'A' => '[list.*.name]',
@@ -3499,10 +3477,12 @@ public function test_schema_multi_combination3()
],
6 => [
'B' => '[total.count]',
+ 'Q' => null,
],
7 => [
'C' => '=D6 [oops]',
'D' => 'D6',
+ 'Q' => null,
],
],
@@ -3579,6 +3559,7 @@ public function test_schema_multi_combination3()
['from' => 'C4', 'to' => 'C5'],
['from' => 'D4', 'to' => 'D5'],
['from' => 'E4', 'to' => 'E5'],
+ ['from' => 'F4', 'to' => 'F5'],
['from' => 'G3', 'to' => 'H3'],
['from' => 'G3', 'to' => 'I3'],
['from' => 'G4', 'to' => 'G5'],
@@ -3586,6 +3567,10 @@ public function test_schema_multi_combination3()
['from' => 'G4', 'to' => 'K4'],
['from' => 'I4', 'to' => 'I5'],
['from' => 'K4', 'to' => 'K5'],
+ ['from' => 'M4', 'to' => 'M5'],
+ ['from' => 'N4', 'to' => 'N5'],
+ ['from' => 'O4', 'to' => 'O5'],
+ ['from' => 'P4', 'to' => 'P5'],
['from' => 'Q4', 'to' => 'Q5'],
],
@@ -3601,22 +3586,6 @@ public function test_schema_multi_combination3()
['from' => 'H', 'to' => 'J'],
['from' => 'H', 'to' => 'L'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A4', 'to' => 'A5'],
- ['from' => 'B4', 'to' => 'B5'],
- ['from' => 'C4', 'to' => 'C5'],
- ['from' => 'D4', 'to' => 'D5'],
- ['from' => 'E4', 'to' => 'E5'],
- ['from' => 'G3', 'to' => 'H3'],
- ['from' => 'G3', 'to' => 'I3'],
- ['from' => 'G4', 'to' => 'G5'],
- ['from' => 'G4', 'to' => 'I4'],
- ['from' => 'G4', 'to' => 'K4'],
- ['from' => 'I4', 'to' => 'I5'],
- ['from' => 'K4', 'to' => 'K5'],
- ['from' => 'Q4', 'to' => 'Q5'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -3634,6 +3603,7 @@ public function test_schema_multi_combination3_limit()
'values' => [
1 => [
'B' => '[title]',
+ 'G' => null,
],
3 => [
'G' => '[column.*.month.*] [= column.0.month]',
@@ -3648,6 +3618,7 @@ public function test_schema_multi_combination3_limit()
],
6 => [
'B' => '[total.count]',
+ 'G' => null,
],
],
@@ -3706,11 +3677,6 @@ public function test_schema_multi_combination3_limit()
['from' => 'G', 'to' => 'H'],
['from' => 'G', 'to' => 'I'],
],
-
- 'copy_cell_format' => [
- ['from' => 'G3', 'to' => 'H3'],
- ['from' => 'G3', 'to' => 'I3'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -3740,6 +3706,7 @@ public function test_schema_table_with_formula1()
'C' => '=A2*B2',
'D' => '=A1+A3+A4',
'E' => 'A1+A3+A4',
+ 'F' => null,
],
3 => [
'A' => '=A4',
@@ -3822,19 +3789,12 @@ public function test_schema_table_with_formula1()
['from' => 'C2', 'to' => 'C3:C5'],
['from' => 'D2', 'to' => 'D3:D5'],
['from' => 'E2', 'to' => 'E3:E5'],
+ ['from' => 'F2', 'to' => 'F3:F5'],
],
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A5'],
- ['from' => 'B2', 'to' => 'B3:B5'],
- ['from' => 'C2', 'to' => 'C3:C5'],
- ['from' => 'D2', 'to' => 'D3:D5'],
- ['from' => 'E2', 'to' => 'E3:E5'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -3864,20 +3824,25 @@ public function test_schema_table_with_formula2()
],
2 => [
'A' => '[= hello]',
+ 'K' => null,
],
3 => [
'A' => '[table.price]',
'B' => '[table.count]',
'C' => '=A3*B3',
+ 'K' => null,
],
4 => [
'A' => '[=hello]',
+ 'K' => null,
],
5 => [
'A' => '[!table]',
+ 'K' => null,
],
6 => [
'A' => '[!table.count]',
+ 'K' => null,
],
7 => [
'A' => '=A1',
@@ -3972,17 +3937,19 @@ public function test_schema_table_with_formula2()
['from' => 'A2', 'to' => 'A3:A6'],
['from' => 'B2', 'to' => 'B3:B6'],
['from' => 'C2', 'to' => 'C3:C6'],
+ ['from' => 'D2', 'to' => 'D3:D6'],
+ ['from' => 'E2', 'to' => 'E3:E6'],
+ ['from' => 'F2', 'to' => 'F3:F6'],
+ ['from' => 'G2', 'to' => 'G3:G6'],
+ ['from' => 'H2', 'to' => 'H3:H6'],
+ ['from' => 'I2', 'to' => 'I3:I6'],
+ ['from' => 'J2', 'to' => 'J3:J6'],
+ ['from' => 'K2', 'to' => 'K3:K6'],
],
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A6'],
- ['from' => 'B2', 'to' => 'B3:B6'],
- ['from' => 'C2', 'to' => 'C3:C6'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -4009,11 +3976,13 @@ public function test_schema_table_with_formula3()
],
2 => [
'A' => '[= hello]',
+ 'G' => null,
],
3 => [
'A' => '[table.price]',
'B' => '[table.count]',
'C' => '=A3*B3+C1+D2+E4+F5',
+ 'G' => null,
],
4 => [
'A' => '=AA1',
@@ -4096,17 +4065,15 @@ public function test_schema_table_with_formula3()
['from' => 'A2', 'to' => 'A3:A6'],
['from' => 'B2', 'to' => 'B3:B6'],
['from' => 'C2', 'to' => 'C3:C6'],
+ ['from' => 'D2', 'to' => 'D3:D6'],
+ ['from' => 'E2', 'to' => 'E3:E6'],
+ ['from' => 'F2', 'to' => 'F3:F6'],
+ ['from' => 'G2', 'to' => 'G3:G6'],
],
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A6'],
- ['from' => 'B2', 'to' => 'B3:B6'],
- ['from' => 'C2', 'to' => 'C3:C6'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -4178,12 +4145,6 @@ public function test_schema_matrix_merge_1x1()
['from' => 'A', 'to' => 'C'],
['from' => 'A', 'to' => 'D'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'B2'],
- ['from' => 'A2', 'to' => 'C2'],
- ['from' => 'A2', 'to' => 'D2'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4258,12 +4219,6 @@ public function test_schema_matrix_merge_1x2()
['from' => 'B', 'to' => 'F'],
['from' => 'B', 'to' => 'H'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'C2'],
- ['from' => 'A2', 'to' => 'E2'],
- ['from' => 'A2', 'to' => 'G2'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4341,12 +4296,6 @@ public function test_schema_matrix_merge_1x3()
['from' => 'C', 'to' => 'I'],
['from' => 'C', 'to' => 'L'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'D2'],
- ['from' => 'A2', 'to' => 'G2'],
- ['from' => 'A2', 'to' => 'J2'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4438,16 +4387,6 @@ public function test_schema_matrix_merge_3x1()
['from' => 'A', 'to' => 'C'],
['from' => 'A', 'to' => 'D'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'A2', 'to' => 'B2'],
- ['from' => 'A2', 'to' => 'C2'],
- ['from' => 'A2', 'to' => 'D2'],
- ['from' => 'B2', 'to' => 'B3:B4'],
- ['from' => 'C2', 'to' => 'C3:C4'],
- ['from' => 'D2', 'to' => 'D3:D4'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4546,16 +4485,6 @@ public function test_schema_matrix_merge_3x2()
['from' => 'B', 'to' => 'F'],
['from' => 'B', 'to' => 'H'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'A2', 'to' => 'C2'],
- ['from' => 'A2', 'to' => 'E2'],
- ['from' => 'A2', 'to' => 'G2'],
- ['from' => 'C2', 'to' => 'C3:C4'],
- ['from' => 'E2', 'to' => 'E3:E4'],
- ['from' => 'G2', 'to' => 'G3:G4'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4657,16 +4586,6 @@ public function test_schema_matrix_merge_3x3()
['from' => 'C', 'to' => 'I'],
['from' => 'C', 'to' => 'L'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3:A4'],
- ['from' => 'A2', 'to' => 'D2'],
- ['from' => 'A2', 'to' => 'G2'],
- ['from' => 'A2', 'to' => 'J2'],
- ['from' => 'D2', 'to' => 'D3:D4'],
- ['from' => 'G2', 'to' => 'G3:G4'],
- ['from' => 'J2', 'to' => 'J3:J4'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4764,17 +4683,6 @@ public function test_schema_matrix_merge_multi1()
['from' => 'D', 'to' => 'F'],
['from' => 'D', 'to' => 'H'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A3', 'to' => 'A4:A5'],
- ['from' => 'C2', 'to' => 'E2'],
- ['from' => 'C2', 'to' => 'G2'],
- ['from' => 'C3', 'to' => 'C4:C5'],
- ['from' => 'C3', 'to' => 'E3'],
- ['from' => 'C3', 'to' => 'G3'],
- ['from' => 'E3', 'to' => 'E4:E5'],
- ['from' => 'G3', 'to' => 'G4:G5'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4874,17 +4782,6 @@ public function test_schema_matrix_merge_multi2()
['from' => 'F', 'to' => 'I'],
['from' => 'F', 'to' => 'L'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A3', 'to' => 'A4:A5'],
- ['from' => 'D2', 'to' => 'G2'],
- ['from' => 'D2', 'to' => 'J2'],
- ['from' => 'D3', 'to' => 'D4:D5'],
- ['from' => 'D3', 'to' => 'G3'],
- ['from' => 'D3', 'to' => 'J3'],
- ['from' => 'G3', 'to' => 'G4:G5'],
- ['from' => 'J3', 'to' => 'J4:J5'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4903,10 +4800,12 @@ public function test_schema_list_merge_0x2()
1 => [
'A' => '=SUM(A2:A2)',
'B' => '=SUM(B3:B3)',
+ 'C' => null,
],
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'C' => null,
],
3 => [
'B' => '[project.amount_1]',
@@ -4914,6 +4813,7 @@ public function test_schema_list_merge_0x2()
],
4 => [
'A' => '[foo]',
+ 'C' => null,
],
],
@@ -4954,8 +4854,6 @@ public function test_schema_list_merge_0x2()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -4974,10 +4872,12 @@ public function test_schema_list_merge_1x2()
1 => [
'A' => '=SUM(A2:A2)',
'B' => '=SUM(B3:B3)',
+ 'C' => null,
],
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'C' => null,
],
3 => [
'B' => '[project.amount_1]',
@@ -4985,6 +4885,7 @@ public function test_schema_list_merge_1x2()
],
4 => [
'A' => '[foo]',
+ 'C' => null,
],
],
@@ -5027,8 +4928,6 @@ public function test_schema_list_merge_1x2()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5047,10 +4946,12 @@ public function test_schema_list_merge_2x2()
1 => [
'A' => '=SUM(A2:A2)',
'B' => '=SUM(B3:B3)',
+ 'C' => null,
],
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'C' => null,
],
3 => [
'B' => '[project.amount_1]',
@@ -5058,6 +4959,7 @@ public function test_schema_list_merge_2x2()
],
4 => [
'A' => '[foo]',
+ 'C' => null,
],
],
@@ -5110,6 +5012,7 @@ public function test_schema_list_merge_2x2()
['from' => 'A2', 'to' => 'A4'],
['from' => 'B2', 'to' => 'B4'],
['from' => 'B3', 'to' => 'B5'],
+ ['from' => 'C2', 'to' => 'C4'],
['from' => 'C3', 'to' => 'C5'],
],
@@ -5118,13 +5021,6 @@ public function test_schema_list_merge_2x2()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A4'],
- ['from' => 'B2', 'to' => 'B4'],
- ['from' => 'B3', 'to' => 'B5'],
- ['from' => 'C3', 'to' => 'C5'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5150,6 +5046,7 @@ public function test_schema_list_merge_2x2_skip()
],
4 => [
'A' => '[foo]',
+ 'B' => null,
],
],
@@ -5196,10 +5093,6 @@ public function test_schema_list_merge_2x2_skip()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'B2', 'to' => 'B3'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5218,10 +5111,12 @@ public function test_schema_list_merge_3x2()
1 => [
'A' => '=SUM(A2:A2)',
'B' => '=SUM(B3:B3)',
+ 'C' => null,
],
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'C' => null,
],
3 => [
'B' => '[project.amount_1]',
@@ -5229,6 +5124,7 @@ public function test_schema_list_merge_3x2()
],
4 => [
'A' => '[foo]',
+ 'C' => null,
],
],
@@ -5293,6 +5189,8 @@ public function test_schema_list_merge_3x2()
['from' => 'B2', 'to' => 'B6'],
['from' => 'B3', 'to' => 'B5'],
['from' => 'B3', 'to' => 'B7'],
+ ['from' => 'C2', 'to' => 'C4'],
+ ['from' => 'C2', 'to' => 'C6'],
['from' => 'C3', 'to' => 'C5'],
['from' => 'C3', 'to' => 'C7'],
],
@@ -5302,17 +5200,6 @@ public function test_schema_list_merge_3x2()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A4'],
- ['from' => 'A2', 'to' => 'A6'],
- ['from' => 'B2', 'to' => 'B4'],
- ['from' => 'B2', 'to' => 'B6'],
- ['from' => 'B3', 'to' => 'B5'],
- ['from' => 'B3', 'to' => 'B7'],
- ['from' => 'C3', 'to' => 'C5'],
- ['from' => 'C3', 'to' => 'C7'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5331,10 +5218,12 @@ public function test_schema_list_merge_4x2()
1 => [
'A' => '=SUM(A2:A2)',
'B' => '=SUM(B3:B3)',
+ 'C' => null,
],
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'C' => null,
],
3 => [
'B' => '[project.amount_1]',
@@ -5342,6 +5231,7 @@ public function test_schema_list_merge_4x2()
],
4 => [
'A' => '[foo]',
+ 'C' => null,
],
],
@@ -5418,6 +5308,9 @@ public function test_schema_list_merge_4x2()
['from' => 'B3', 'to' => 'B5'],
['from' => 'B3', 'to' => 'B7'],
['from' => 'B3', 'to' => 'B9'],
+ ['from' => 'C2', 'to' => 'C4'],
+ ['from' => 'C2', 'to' => 'C6'],
+ ['from' => 'C2', 'to' => 'C8'],
['from' => 'C3', 'to' => 'C5'],
['from' => 'C3', 'to' => 'C7'],
['from' => 'C3', 'to' => 'C9'],
@@ -5428,21 +5321,6 @@ public function test_schema_list_merge_4x2()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A4'],
- ['from' => 'A2', 'to' => 'A6'],
- ['from' => 'A2', 'to' => 'A8'],
- ['from' => 'B2', 'to' => 'B4'],
- ['from' => 'B2', 'to' => 'B6'],
- ['from' => 'B2', 'to' => 'B8'],
- ['from' => 'B3', 'to' => 'B5'],
- ['from' => 'B3', 'to' => 'B7'],
- ['from' => 'B3', 'to' => 'B9'],
- ['from' => 'C3', 'to' => 'C5'],
- ['from' => 'C3', 'to' => 'C7'],
- ['from' => 'C3', 'to' => 'C9'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5466,15 +5344,18 @@ public function test_schema_list_merge_4x3()
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'C' => null,
],
3 => [
'B' => '[project.amount_1]',
+ 'C' => null,
],
4 => [
'C' => '[project.amount_2]',
],
6 => [
'A' => '[foo]',
+ 'C' => null,
],
],
@@ -5560,6 +5441,15 @@ public function test_schema_list_merge_4x3()
['from' => 'B3', 'to' => 'B6'],
['from' => 'B3', 'to' => 'B9'],
['from' => 'B3', 'to' => 'B12'],
+ ['from' => 'B4', 'to' => 'B7'],
+ ['from' => 'B4', 'to' => 'B10'],
+ ['from' => 'B4', 'to' => 'B13'],
+ ['from' => 'C2', 'to' => 'C5'],
+ ['from' => 'C2', 'to' => 'C8'],
+ ['from' => 'C2', 'to' => 'C11'],
+ ['from' => 'C3', 'to' => 'C6'],
+ ['from' => 'C3', 'to' => 'C9'],
+ ['from' => 'C3', 'to' => 'C12'],
['from' => 'C4', 'to' => 'C7'],
['from' => 'C4', 'to' => 'C10'],
['from' => 'C4', 'to' => 'C13'],
@@ -5570,27 +5460,12 @@ public function test_schema_list_merge_4x3()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A5'],
- ['from' => 'A2', 'to' => 'A8'],
- ['from' => 'A2', 'to' => 'A11'],
- ['from' => 'B2', 'to' => 'B5'],
- ['from' => 'B2', 'to' => 'B8'],
- ['from' => 'B2', 'to' => 'B11'],
- ['from' => 'B3', 'to' => 'B6'],
- ['from' => 'B3', 'to' => 'B9'],
- ['from' => 'B3', 'to' => 'B12'],
- ['from' => 'C4', 'to' => 'C7'],
- ['from' => 'C4', 'to' => 'C10'],
- ['from' => 'C4', 'to' => 'C13'],
- ],
- ],
- $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
- "$id"
- );
- }
- }
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
/**
* @return void
@@ -5609,15 +5484,19 @@ public function test_schema_list_merge_4x4()
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'D' => null,
],
3 => [
'B' => '[project.amount_1]',
+ 'D' => null,
],
4 => [
'C' => '[project.amount_2]',
+ 'D' => null,
],
6 => [
'A' => '[foo]',
+ 'D' => null,
],
],
@@ -5704,9 +5583,36 @@ public function test_schema_list_merge_4x4()
['from' => 'B3', 'to' => 'B7'],
['from' => 'B3', 'to' => 'B11'],
['from' => 'B3', 'to' => 'B15'],
+ ['from' => 'B4', 'to' => 'B8'],
+ ['from' => 'B4', 'to' => 'B12'],
+ ['from' => 'B4', 'to' => 'B16'],
+ ['from' => 'B5', 'to' => 'B9'],
+ ['from' => 'B5', 'to' => 'B13'],
+ ['from' => 'B5', 'to' => 'B17'],
+ ['from' => 'C2', 'to' => 'C6'],
+ ['from' => 'C2', 'to' => 'C10'],
+ ['from' => 'C2', 'to' => 'C14'],
+ ['from' => 'C3', 'to' => 'C7'],
+ ['from' => 'C3', 'to' => 'C11'],
+ ['from' => 'C3', 'to' => 'C15'],
['from' => 'C4', 'to' => 'C8'],
['from' => 'C4', 'to' => 'C12'],
['from' => 'C4', 'to' => 'C16'],
+ ['from' => 'C5', 'to' => 'C9'],
+ ['from' => 'C5', 'to' => 'C13'],
+ ['from' => 'C5', 'to' => 'C17'],
+ ['from' => 'D2', 'to' => 'D6'],
+ ['from' => 'D2', 'to' => 'D10'],
+ ['from' => 'D2', 'to' => 'D14'],
+ ['from' => 'D3', 'to' => 'D7'],
+ ['from' => 'D3', 'to' => 'D11'],
+ ['from' => 'D3', 'to' => 'D15'],
+ ['from' => 'D4', 'to' => 'D8'],
+ ['from' => 'D4', 'to' => 'D12'],
+ ['from' => 'D4', 'to' => 'D16'],
+ ['from' => 'D5', 'to' => 'D9'],
+ ['from' => 'D5', 'to' => 'D13'],
+ ['from' => 'D5', 'to' => 'D17'],
],
'merge_cells' => [
@@ -5714,21 +5620,6 @@ public function test_schema_list_merge_4x4()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A6'],
- ['from' => 'A2', 'to' => 'A10'],
- ['from' => 'A2', 'to' => 'A14'],
- ['from' => 'B2', 'to' => 'B6'],
- ['from' => 'B2', 'to' => 'B10'],
- ['from' => 'B2', 'to' => 'B14'],
- ['from' => 'B3', 'to' => 'B7'],
- ['from' => 'B3', 'to' => 'B11'],
- ['from' => 'B3', 'to' => 'B15'],
- ['from' => 'C4', 'to' => 'C8'],
- ['from' => 'C4', 'to' => 'C12'],
- ['from' => 'C4', 'to' => 'C16'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5754,15 +5645,19 @@ public function test_schema_list_merge_4x5()
2 => [
'A' => '[project.id]',
'B' => '[project.name]',
+ 'E' => null,
],
3 => [
'B' => '[project.amount_1]',
+ 'E' => null,
],
5 => [
'C' => '[project.amount_2]',
+ 'E' => null,
],
7 => [
'A' => '[foo]',
+ 'E' => null,
],
],
@@ -5850,9 +5745,60 @@ public function test_schema_list_merge_4x5()
['from' => 'B3', 'to' => 'B8'],
['from' => 'B3', 'to' => 'B13'],
['from' => 'B3', 'to' => 'B18'],
+ ['from' => 'B4', 'to' => 'B9'],
+ ['from' => 'B4', 'to' => 'B14'],
+ ['from' => 'B4', 'to' => 'B19'],
+ ['from' => 'B5', 'to' => 'B10'],
+ ['from' => 'B5', 'to' => 'B15'],
+ ['from' => 'B5', 'to' => 'B20'],
+ ['from' => 'B6', 'to' => 'B11'],
+ ['from' => 'B6', 'to' => 'B16'],
+ ['from' => 'B6', 'to' => 'B21'],
+ ['from' => 'C2', 'to' => 'C7'],
+ ['from' => 'C2', 'to' => 'C12'],
+ ['from' => 'C2', 'to' => 'C17'],
+ ['from' => 'C3', 'to' => 'C8'],
+ ['from' => 'C3', 'to' => 'C13'],
+ ['from' => 'C3', 'to' => 'C18'],
+ ['from' => 'C4', 'to' => 'C9'],
+ ['from' => 'C4', 'to' => 'C14'],
+ ['from' => 'C4', 'to' => 'C19'],
['from' => 'C5', 'to' => 'C10'],
['from' => 'C5', 'to' => 'C15'],
['from' => 'C5', 'to' => 'C20'],
+ ['from' => 'C6', 'to' => 'C11'],
+ ['from' => 'C6', 'to' => 'C16'],
+ ['from' => 'C6', 'to' => 'C21'],
+ ['from' => 'D2', 'to' => 'D7'],
+ ['from' => 'D2', 'to' => 'D12'],
+ ['from' => 'D2', 'to' => 'D17'],
+ ['from' => 'D3', 'to' => 'D8'],
+ ['from' => 'D3', 'to' => 'D13'],
+ ['from' => 'D3', 'to' => 'D18'],
+ ['from' => 'D4', 'to' => 'D9'],
+ ['from' => 'D4', 'to' => 'D14'],
+ ['from' => 'D4', 'to' => 'D19'],
+ ['from' => 'D5', 'to' => 'D10'],
+ ['from' => 'D5', 'to' => 'D15'],
+ ['from' => 'D5', 'to' => 'D20'],
+ ['from' => 'D6', 'to' => 'D11'],
+ ['from' => 'D6', 'to' => 'D16'],
+ ['from' => 'D6', 'to' => 'D21'],
+ ['from' => 'E2', 'to' => 'E7'],
+ ['from' => 'E2', 'to' => 'E12'],
+ ['from' => 'E2', 'to' => 'E17'],
+ ['from' => 'E3', 'to' => 'E8'],
+ ['from' => 'E3', 'to' => 'E13'],
+ ['from' => 'E3', 'to' => 'E18'],
+ ['from' => 'E4', 'to' => 'E9'],
+ ['from' => 'E4', 'to' => 'E14'],
+ ['from' => 'E4', 'to' => 'E19'],
+ ['from' => 'E5', 'to' => 'E10'],
+ ['from' => 'E5', 'to' => 'E15'],
+ ['from' => 'E5', 'to' => 'E20'],
+ ['from' => 'E6', 'to' => 'E11'],
+ ['from' => 'E6', 'to' => 'E16'],
+ ['from' => 'E6', 'to' => 'E21'],
],
'merge_cells' => [
@@ -5860,21 +5806,6 @@ public function test_schema_list_merge_4x5()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A7'],
- ['from' => 'A2', 'to' => 'A12'],
- ['from' => 'A2', 'to' => 'A17'],
- ['from' => 'B2', 'to' => 'B7'],
- ['from' => 'B2', 'to' => 'B12'],
- ['from' => 'B2', 'to' => 'B17'],
- ['from' => 'B3', 'to' => 'B8'],
- ['from' => 'B3', 'to' => 'B13'],
- ['from' => 'B3', 'to' => 'B18'],
- ['from' => 'C5', 'to' => 'C10'],
- ['from' => 'C5', 'to' => 'C15'],
- ['from' => 'C5', 'to' => 'C20'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -5902,6 +5833,7 @@ public function test_schema_list_merge_multi()
],
'5' => [
'A' => '=A1',
+ 'B' => null,
],
],
@@ -5986,6 +5918,8 @@ public function test_schema_list_merge_multi()
['from' => 'B2', 'to' => 'B8'],
['from' => 'B2', 'to' => 'D2'],
['from' => 'B2', 'to' => 'F2'],
+ ['from' => 'B3', 'to' => 'B6'],
+ ['from' => 'B3', 'to' => 'B9'],
['from' => 'B4', 'to' => 'B7'],
['from' => 'B4', 'to' => 'B10'],
['from' => 'B4', 'to' => 'D4'],
@@ -6016,29 +5950,6 @@ public function test_schema_list_merge_multi()
['from' => 'C', 'to' => 'E'],
['from' => 'C', 'to' => 'G'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A5'],
- ['from' => 'A2', 'to' => 'A8'],
- ['from' => 'B1', 'to' => 'D1'],
- ['from' => 'B1', 'to' => 'F1'],
- ['from' => 'B2', 'to' => 'B5'],
- ['from' => 'B2', 'to' => 'B8'],
- ['from' => 'B2', 'to' => 'D2'],
- ['from' => 'B2', 'to' => 'F2'],
- ['from' => 'B4', 'to' => 'B7'],
- ['from' => 'B4', 'to' => 'B10'],
- ['from' => 'B4', 'to' => 'D4'],
- ['from' => 'B4', 'to' => 'F4'],
- ['from' => 'D2', 'to' => 'D5'],
- ['from' => 'D2', 'to' => 'D8'],
- ['from' => 'D4', 'to' => 'D7'],
- ['from' => 'D4', 'to' => 'D10'],
- ['from' => 'F2', 'to' => 'F5'],
- ['from' => 'F2', 'to' => 'F8'],
- ['from' => 'F4', 'to' => 'F7'],
- ['from' => 'F4', 'to' => 'F10'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -6056,6 +5967,7 @@ public function test_schema_multi_shift1()
'values' => [
1 => [
'A' => '[list.qty]',
+ 'B' => null,
],
2 => [
'A' => '=SUM(A1:A1)',
@@ -6063,7 +5975,7 @@ public function test_schema_multi_shift1()
],
3 => [
'A' => '-',
- 'b' => '[! list]',
+ 'B' => '[! list]',
],
],
@@ -6096,15 +6008,12 @@ public function test_schema_multi_shift1()
'copy_style' => [
['from' => 'A1', 'to' => 'A2'],
+ ['from' => 'B1', 'to' => 'B2'],
],
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A2'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -6126,6 +6035,7 @@ public function test_schema_multi_shift2()
],
2 => [
'A' => '[list.qty]',
+ 'B' => null,
],
3 => [
'A' => '=SUM(A2:A2)',
@@ -6133,7 +6043,7 @@ public function test_schema_multi_shift2()
],
4 => [
'A' => '-',
- 'b' => '[! list]',
+ 'B' => '[! list]',
],
],
@@ -6170,15 +6080,12 @@ public function test_schema_multi_shift2()
'copy_style' => [
['from' => 'A2', 'to' => 'A3'],
+ ['from' => 'B2', 'to' => 'B3'],
],
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -6234,10 +6141,6 @@ public function test_schema_multi_shift3()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A2'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -6293,10 +6196,6 @@ public function test_schema_multi_shift4()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A3'],
- ],
],
$this->service->schema($item['values'], $item['data'], [])->toArray(),
"$id"
@@ -6395,21 +6294,6 @@ public function test_schema_multi_merge1()
'merge_cells' => ['A4:A6', 'B4:B5', 'A7:A9', 'B7:B8', 'A10:A12', 'B10:B11'],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A4'],
- ['from' => 'A1', 'to' => 'A7'],
- ['from' => 'A1', 'to' => 'A10'],
- ['from' => 'B1', 'to' => 'B4'],
- ['from' => 'B1', 'to' => 'B7'],
- ['from' => 'B1', 'to' => 'B10'],
- ['from' => 'C1', 'to' => 'C4'],
- ['from' => 'C1', 'to' => 'C7'],
- ['from' => 'C1', 'to' => 'C10'],
- ['from' => 'C2', 'to' => 'C5'],
- ['from' => 'C2', 'to' => 'C8'],
- ['from' => 'C2', 'to' => 'C11'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -6554,31 +6438,6 @@ public function test_schema_multi_merge2()
['from' => 'C', 'to' => 'E'],
['from' => 'C', 'to' => 'G'],
],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A5'],
- ['from' => 'A2', 'to' => 'A8'],
- ['from' => 'B1', 'to' => 'D1'],
- ['from' => 'B1', 'to' => 'F1'],
- ['from' => 'B2', 'to' => 'B5'],
- ['from' => 'B2', 'to' => 'B8'],
- ['from' => 'B2', 'to' => 'D2'],
- ['from' => 'B2', 'to' => 'F2'],
- ['from' => 'B3', 'to' => 'B6'],
- ['from' => 'B3', 'to' => 'B9'],
- ['from' => 'B3', 'to' => 'D3'],
- ['from' => 'B3', 'to' => 'F3'],
- ['from' => 'B4', 'to' => 'B7'],
- ['from' => 'B4', 'to' => 'B10'],
- ['from' => 'D2', 'to' => 'D5'],
- ['from' => 'D2', 'to' => 'D8'],
- ['from' => 'D3', 'to' => 'D6'],
- ['from' => 'D3', 'to' => 'D9'],
- ['from' => 'F2', 'to' => 'F5'],
- ['from' => 'F2', 'to' => 'F8'],
- ['from' => 'F3', 'to' => 'F6'],
- ['from' => 'F3', 'to' => 'F9'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -6690,17 +6549,6 @@ public function test_schema_list_long()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A2:A16'],
- ['from' => 'A25', 'to' => 'A26:A40'],
- ['from' => 'B1', 'to' => 'B2:B16'],
- ['from' => 'B25', 'to' => 'B26:B40'],
- ['from' => 'C1', 'to' => 'C2:C16'],
- ['from' => 'C25', 'to' => 'C26:C40'],
- ['from' => 'D1', 'to' => 'D2:D16'],
- ['from' => 'D25', 'to' => 'D26:D40'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -6777,6 +6625,9 @@ public function test_schema_several_tables1()
['from' => 'A1', 'to' => 'A2:A3'],
['from' => 'A5', 'to' => 'A6:A7'],
['from' => 'A9', 'to' => 'A10:A11'],
+ ['from' => 'B1', 'to' => 'B2:B3'],
+ ['from' => 'B5', 'to' => 'B6:B7'],
+ ['from' => 'B9', 'to' => 'B10:B11'],
['from' => 'C1', 'to' => 'C2:C3'],
['from' => 'C5', 'to' => 'C6:C7'],
['from' => 'C9', 'to' => 'C10:C11'],
@@ -6788,18 +6639,6 @@ public function test_schema_several_tables1()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A2:A3'],
- ['from' => 'A5', 'to' => 'A6:A7'],
- ['from' => 'A9', 'to' => 'A10:A11'],
- ['from' => 'C1', 'to' => 'C2:C3'],
- ['from' => 'C5', 'to' => 'C6:C7'],
- ['from' => 'C9', 'to' => 'C10:C11'],
- ['from' => 'D1', 'to' => 'D2:D3'],
- ['from' => 'D5', 'to' => 'D6:D7'],
- ['from' => 'D9', 'to' => 'D10:D11'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -6817,17 +6656,17 @@ public function test_schema_several_tables2()
'values' => [
1 => [
'A' => '[tableOne.a]',
- 'C' => '',
+ 'C' => null,
'D' => '[tableOne.d]',
],
3 => [
'A' => '[tableTwo.a]',
- 'C' => '',
+ 'C' => null,
'D' => '[tableTwo.d]',
],
5 => [
'A' => '[tableThree.a]',
- 'C' => '',
+ 'C' => null,
'D' => '[tableThree.d]',
],
],
@@ -6865,6 +6704,7 @@ public function test_schema_several_tables2()
'copy_style' => [
['from' => 'A5', 'to' => 'A6:A7'],
+ ['from' => 'B5', 'to' => 'B6:B7'],
['from' => 'C5', 'to' => 'C6:C7'],
['from' => 'D5', 'to' => 'D6:D7'],
],
@@ -6872,12 +6712,6 @@ public function test_schema_several_tables2()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A5', 'to' => 'A6:A7'],
- ['from' => 'C5', 'to' => 'C6:C7'],
- ['from' => 'D5', 'to' => 'D6:D7'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -6972,21 +6806,6 @@ public function test_schema_several_tables3()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A3'],
- ['from' => 'A1', 'to' => 'A5'],
- ['from' => 'A7', 'to' => 'A9'],
- ['from' => 'A7', 'to' => 'A11'],
- ['from' => 'A13', 'to' => 'A15'],
- ['from' => 'A13', 'to' => 'A17'],
- ['from' => 'B1', 'to' => 'B3'],
- ['from' => 'B1', 'to' => 'B5'],
- ['from' => 'B7', 'to' => 'B9'],
- ['from' => 'B7', 'to' => 'B11'],
- ['from' => 'B13', 'to' => 'B15'],
- ['from' => 'B13', 'to' => 'B17'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7069,17 +6888,6 @@ public function test_schema_several_tables4()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A3'],
- ['from' => 'A1', 'to' => 'A5'],
- ['from' => 'A7', 'to' => 'A9'],
- ['from' => 'A7', 'to' => 'A11'],
- ['from' => 'B1', 'to' => 'B3'],
- ['from' => 'B1', 'to' => 'B5'],
- ['from' => 'B7', 'to' => 'B9'],
- ['from' => 'B7', 'to' => 'B11'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7102,6 +6910,7 @@ public function test_schema_merge1()
],
2 => [
'A' => 'baz',
+ 'D' => null,
],
],
@@ -7141,12 +6950,6 @@ public function test_schema_merge1()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A2:A3'],
- ['from' => 'B1', 'to' => 'B2:B3'],
- ['from' => 'D1', 'to' => 'D2:D3'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7207,13 +7010,6 @@ public function test_schema_merge2()
],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'B1', 'to' => 'B2:B3'],
- ['from' => 'C1', 'to' => 'C2:C3'],
- ['from' => 'D1', 'to' => 'D2:D3'],
- ['from' => 'F1', 'to' => 'F2:F3'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7242,7 +7038,8 @@ public function test_schema_merge3()
'A' => '[foo]',
'B' => '[bar]',
'C' => 1,
- 'D' => '1'
+ 'D' => '1',
+ 'H' => null,
],
],
@@ -7283,15 +7080,6 @@ public function test_schema_merge3()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'C1', 'to' => 'C2:C3'],
- ['from' => 'D1', 'to' => 'D2:D3'],
- ['from' => 'E1', 'to' => 'E2:E3'],
- ['from' => 'F1', 'to' => 'F2:F3'],
- ['from' => 'G1', 'to' => 'G2:G3'],
- ['from' => 'H1', 'to' => 'H2:H3'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7309,12 +7097,14 @@ public function test_schema_merge4()
'values' => [
1 => [
'A' => 'Hello',
+ 'B' => null,
],
2 => [
'B' => '[table.a]',
],
4 => [
- 'A' => '[bar]'
+ 'A' => '[bar]',
+ 'B' => null,
],
],
@@ -7373,10 +7163,6 @@ public function test_schema_merge4()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'B2', 'to' => 'B3:B4'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7394,9 +7180,11 @@ public function test_schema_merge5()
'values' => [
1 => [
'A' => '=SUM(B3:B3)',
+ 'B' => null,
],
2 => [
'A' => 'Foo',
+ 'B' => null,
],
3 => [
'B' => '[product.amount]'
@@ -7434,10 +7222,6 @@ public function test_schema_merge5()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'B3', 'to' => 'B4:B5'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7455,9 +7239,11 @@ public function test_schema_merge6()
'values' => [
1 => [
'A' => '=SUM(B3:B3)',
+ 'B' => null,
],
2 => [
'A' => '[product.id]',
+ 'B' => null,
],
3 => [
'B' => '[product.amount]'
@@ -7495,6 +7281,8 @@ public function test_schema_merge6()
'copy_style' => [
['from' => 'A2', 'to' => 'A5'],
['from' => 'A2', 'to' => 'A8'],
+ ['from' => 'B2', 'to' => 'B5'],
+ ['from' => 'B2', 'to' => 'B8'],
['from' => 'B3', 'to' => 'B6'],
['from' => 'B3', 'to' => 'B9'],
],
@@ -7502,13 +7290,6 @@ public function test_schema_merge6()
'merge_cells' => ['A5:A7', 'A8:A10'],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A2', 'to' => 'A5'],
- ['from' => 'A2', 'to' => 'A8'],
- ['from' => 'B3', 'to' => 'B6'],
- ['from' => 'B3', 'to' => 'B9'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7611,10 +7392,6 @@ public function test_schema_alias1()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [
- ['from' => 'A1', 'to' => 'A2:A3'],
- ],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7677,8 +7454,6 @@ public function test_schema_alias2()
'merge_cells' => [],
'copy_width' => [],
-
- 'copy_cell_format' => [],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
@@ -7731,8 +7506,395 @@ public function test_schema_alias3()
'merge_cells' => [],
'copy_width' => [],
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
+
+ /**
+ * @return void
+ */
+ public function test_schema_styles1()
+ {
+ $data = [
+ [
+ 'values' => [
+ 1 => [
+ 'A' => '[product.id]',
+ 'E' => null,
+ ],
+ ],
+
+ 'data' => [
+ 'product' => [
+ 'id' => [1, 2, 3],
+ ],
+ ],
+
+ 'merge_cells' => ['C1:D1'],
+ ],
+ ];
+
+ foreach ($data as $id => $item) {
+ $this->assertSame(
+ [
+ 'data' => [
+ 1 => ['A' => 1],
+ 2 => ['A' => 2],
+ 3 => ['A' => 3],
+ ],
+
+ 'rows' => [
+ ['action' => 'add', 'row' => 2, 'qty' => 2],
+ ],
- 'copy_cell_format' => [],
+ 'copy_style' => [
+ ['from' => 'A1', 'to' => 'A2:A3'],
+ ['from' => 'B1', 'to' => 'B2:B3'],
+ ['from' => 'C1', 'to' => 'C2:C3'],
+ ['from' => 'E1', 'to' => 'E2:E3'],
+ ],
+
+ 'merge_cells' => [
+ 'C2:D2', 'C3:D3',
+ ],
+
+ 'copy_width' => [],
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
+
+ /**
+ * @return void
+ */
+ public function test_schema_styles2()
+ {
+ $data = [
+ [
+ 'values' => [
+ 1 => [
+ 'A' => '[product.id]',
+ 'D' => null,
+ ],
+ ],
+
+ 'data' => [
+ 'product' => [
+ 'id' => [1, 2, 3],
+ ],
+ ],
+
+ 'merge_cells' => ['C1:D1'],
+ ],
+ ];
+
+ foreach ($data as $id => $item) {
+ $this->assertSame(
+ [
+ 'data' => [
+ 1 => ['A' => 1],
+ 2 => ['A' => 2],
+ 3 => ['A' => 3],
+ ],
+
+ 'rows' => [
+ ['action' => 'add', 'row' => 2, 'qty' => 2],
+ ],
+
+ 'copy_style' => [
+ ['from' => 'A1', 'to' => 'A2:A3'],
+ ['from' => 'B1', 'to' => 'B2:B3'],
+ ['from' => 'C1', 'to' => 'C2:C3'],
+ ],
+
+ 'merge_cells' => [
+ 'C2:D2', 'C3:D3',
+ ],
+
+ 'copy_width' => [],
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
+
+ /**
+ * @return void
+ */
+ public function test_schema_styles3()
+ {
+ $data = [
+ [
+ 'values' => [
+ 1 => [
+ 'B' => '[product.id]',
+ 'E' => null,
+ ],
+ ],
+
+ 'data' => [
+ 'product' => [
+ 'id' => [1, 2, 3],
+ ],
+ ],
+
+ 'merge_cells' => ['C1:D1'],
+ ],
+ ];
+
+ foreach ($data as $id => $item) {
+ $this->assertSame(
+ [
+ 'data' => [
+ 1 => ['B' => 1],
+ 2 => ['B' => 2],
+ 3 => ['B' => 3],
+ ],
+
+ 'rows' => [
+ ['action' => 'add', 'row' => 2, 'qty' => 2],
+ ],
+
+ 'copy_style' => [
+ ['from' => 'A1', 'to' => 'A2:A3'],
+ ['from' => 'B1', 'to' => 'B2:B3'],
+ ['from' => 'C1', 'to' => 'C2:C3'],
+ ['from' => 'E1', 'to' => 'E2:E3'],
+ ],
+
+ 'merge_cells' => [
+ 'C2:D2', 'C3:D3',
+ ],
+
+ 'copy_width' => [],
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
+
+ /**
+ * @return void
+ */
+ public function test_schema_styles4()
+ {
+ $data = [
+ [
+ 'values' => [
+ 1 => [
+ 'A' => '[product.id]',
+ 'BA' => null,
+ ],
+ ],
+
+ 'data' => [
+ 'product' => [
+ 'id' => [1, 2, 3],
+ ],
+ ],
+
+ 'merge_cells' => ['AB1:BA1'],
+ ],
+ ];
+
+ foreach ($data as $id => $item) {
+ $this->assertSame(
+ [
+ 'data' => [
+ 1 => ['A' => 1],
+ 2 => ['A' => 2],
+ 3 => ['A' => 3],
+ ],
+
+ 'rows' => [
+ ['action' => 'add', 'row' => 2, 'qty' => 2],
+ ],
+
+ 'copy_style' => [
+ ['from' => 'A1', 'to' => 'A2:A3'],
+ ['from' => 'AA1', 'to' => 'AA2:AA3'],
+ ['from' => 'AB1', 'to' => 'AB2:AB3'],
+ ['from' => 'B1', 'to' => 'B2:B3'],
+ ['from' => 'C1', 'to' => 'C2:C3'],
+ ['from' => 'D1', 'to' => 'D2:D3'],
+ ['from' => 'E1', 'to' => 'E2:E3'],
+ ['from' => 'F1', 'to' => 'F2:F3'],
+ ['from' => 'G1', 'to' => 'G2:G3'],
+ ['from' => 'H1', 'to' => 'H2:H3'],
+ ['from' => 'I1', 'to' => 'I2:I3'],
+ ['from' => 'J1', 'to' => 'J2:J3'],
+ ['from' => 'K1', 'to' => 'K2:K3'],
+ ['from' => 'L1', 'to' => 'L2:L3'],
+ ['from' => 'M1', 'to' => 'M2:M3'],
+ ['from' => 'N1', 'to' => 'N2:N3'],
+ ['from' => 'O1', 'to' => 'O2:O3'],
+ ['from' => 'P1', 'to' => 'P2:P3'],
+ ['from' => 'Q1', 'to' => 'Q2:Q3'],
+ ['from' => 'R1', 'to' => 'R2:R3'],
+ ['from' => 'S1', 'to' => 'S2:S3'],
+ ['from' => 'T1', 'to' => 'T2:T3'],
+ ['from' => 'U1', 'to' => 'U2:U3'],
+ ['from' => 'V1', 'to' => 'V2:V3'],
+ ['from' => 'W1', 'to' => 'W2:W3'],
+ ['from' => 'X1', 'to' => 'X2:X3'],
+ ['from' => 'Y1', 'to' => 'Y2:Y3'],
+ ['from' => 'Z1', 'to' => 'Z2:Z3'],
+ ],
+
+ 'merge_cells' => [
+ 'AB2:BA2', 'AB3:BA3',
+ ],
+
+ 'copy_width' => [],
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
+
+ /**
+ * @return void
+ */
+ public function test_schema_styles5()
+ {
+ $data = [
+ [
+ 'values' => [
+ 1 => [
+ 'C' => '[foo.id]',
+ 'E' => null,
+ ],
+ 2 => [
+ 'A' => '[bar.id]',
+ 'E' => null,
+ ],
+ ],
+
+ 'data' => [
+ 'foo' => [
+ 'id' => [1, 2, 3],
+ ],
+ 'bar' => [
+ 'id' => [4, 5, 6],
+ ],
+ ],
+
+ 'merge_cells' => ['C1:E1', 'A2:D2'],
+ ],
+ ];
+
+ foreach ($data as $id => $item) {
+ $this->assertSame(
+ [
+ 'data' => [
+ 1 => ['C' => 1],
+ 2 => ['C' => 2],
+ 3 => ['C' => 3],
+ 4 => ['A' => 4],
+ 5 => ['A' => 5],
+ 6 => ['A' => 6],
+ ],
+
+ 'rows' => [
+ ['action' => 'add', 'row' => 2, 'qty' => 2],
+ ['action' => 'add', 'row' => 5, 'qty' => 2],
+ ],
+
+ 'copy_style' => [
+ ['from' => 'A1', 'to' => 'A2:A3'],
+ ['from' => 'A4', 'to' => 'A5:A6'],
+ ['from' => 'B1', 'to' => 'B2:B3'],
+ ['from' => 'C1', 'to' => 'C2:C3'],
+ ['from' => 'E4', 'to' => 'E5:E6'],
+ ],
+
+ 'merge_cells' => [
+ 'C2:E2', 'C3:E3',
+ 'A5:D5', 'A6:D6',
+ ],
+
+ 'copy_width' => [],
+ ],
+ $this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
+ "$id"
+ );
+ }
+ }
+
+ /**
+ * @return void
+ */
+ public function test_schema_styles6()
+ {
+ $data = [
+ [
+ 'values' => [
+ 1 => [
+ 'A' => '[= baz]',
+ 'H' => null,
+ ],
+ 2 => [
+ 'C' => '[foo.id]',
+ 'H' => null,
+ ],
+ 4 => [
+ 'A' => '[bar.id]',
+ 'H' => null,
+ ],
+ ],
+
+ 'data' => [
+ 'foo' => [
+ 'id' => [1, 2, 3],
+ ],
+ 'bar' => [
+ 'id' => [4, 5, 6],
+ ],
+ ],
+
+ 'merge_cells' => ['A2:B2', 'C2:G2', 'A4:H4'],
+ ],
+ ];
+
+ foreach ($data as $id => $item) {
+ $this->assertSame(
+ [
+ 'data' => [
+ 1 => ['C' => 1],
+ 2 => ['C' => 2],
+ 3 => ['C' => 3],
+ 5 => ['A' => 4],
+ 6 => ['A' => 5],
+ 7 => ['A' => 6],
+ ],
+
+ 'rows' => [
+ ['action' => 'delete', 'row' => 1, 'qty' => 1],
+ ['action' => 'add', 'row' => 2, 'qty' => 2],
+ ['action' => 'add', 'row' => 6, 'qty' => 2],
+ ],
+
+ 'copy_style' => [
+ ['from' => 'A1', 'to' => 'A2:A3'],
+ ['from' => 'A5', 'to' => 'A6:A7'],
+ ['from' => 'C1', 'to' => 'C2:C3'],
+ ['from' => 'H1', 'to' => 'H2:H3'],
+ ],
+
+ 'merge_cells' => [
+ 'A2:B2', 'C2:G2', 'A3:B3', 'C3:G3',
+ 'A6:H6', 'A7:H7',
+ ],
+
+ 'copy_width' => [],
],
$this->service->schema($item['values'], $item['data'], $item['merge_cells'])->toArray(),
"$id"
diff --git a/tests/TraitsTest.php b/tests/TraitsTest.php
new file mode 100644
index 0000000..fd690ab
--- /dev/null
+++ b/tests/TraitsTest.php
@@ -0,0 +1,59 @@
+assertTrue($this->isColumnLE('A', 'B'));
+ $this->assertTrue($this->isColumnLE('B', 'B'));
+ $this->assertFalse($this->isColumnLE('C', 'B'));
+
+ $this->assertTrue($this->isColumnLE('Z', 'AA'));
+ $this->assertTrue($this->isColumnLE('AA', 'AA'));
+ $this->assertFalse($this->isColumnLE('AB', 'AA'));
+
+ $this->assertFalse($this->isColumnLE('AAA', 'ZZ'));
+ $this->assertTrue($this->isColumnLE('AAA', 'AAA'));
+ $this->assertTrue($this->isColumnLE('AAA', 'AAB'));
+ }
+
+ /**
+ * @return void
+ */
+ public function test_isColumnGE()
+ {
+ $this->assertFalse($this->isColumnGE('A', 'B'));
+ $this->assertTrue($this->isColumnGE('B', 'B'));
+ $this->assertTrue($this->isColumnGE('C', 'B'));
+
+ $this->assertFalse($this->isColumnGE('Z', 'AA'));
+ $this->assertTrue($this->isColumnGE('AA', 'AA'));
+ $this->assertTrue($this->isColumnGE('AB', 'AA'));
+
+ $this->assertTrue($this->isColumnGE('AAA', 'ZZ'));
+ $this->assertTrue($this->isColumnGE('AAA', 'AAA'));
+ $this->assertFalse($this->isColumnGE('AAA', 'AAB'));
+ }
+
+ /**
+ * @return void
+ */
+ public function test_sort()
+ {
+ $columns = ['BA' => 7, 'AZ' => 6, 'A' => 1, 'B' => 2, 'Z' => 3, 'AA' => 4, 'AB' => 5];
+
+ uksort($columns, fn ($a, $b) => $this->isColumnLE($a, $b) ? -1 : 1);
+
+ $this->assertSame(
+ ['A' => 1, 'B' => 2, 'Z' => 3, 'AA' => 4, 'AB' => 5, 'AZ' => 6, 'BA' => 7],
+ $columns
+ );
+ }
+}