Skip to content

Commit a6cfd8c

Browse files
authored
Merge branch 'master' into Issue-3056_Update-DataValidation-SqRef-On-Insert-Delete-Rows-Columns
2 parents 1746a5a + c465b1c commit a6cfd8c

36 files changed

+465
-57
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
1313
- Implementation of the `ARRAYTOTEXT()` and `VALUETOTEXT()` Excel Functions
1414
- Support for [mitoteam/jpgraph](https://packagist.org/packages/mitoteam/jpgraph) implementation of
1515
JpGraph library to render charts added.
16-
- Charts: Add Gradients, Transparency, Hidden Axes, Rounded Corners, Trendlines.
16+
- Charts: Add Gradients, Transparency, Hidden Axes, Rounded Corners, Trendlines, Date Axes.
1717

1818
### Changed
1919

@@ -50,6 +50,11 @@ and this project adheres to [Semantic Versioning](https://semver.org).
5050
- Add setName Method for Chart [Issue #2991](https://github.com/PHPOffice/PhpSpreadsheet/issues/2991) [PR #3001](https://github.com/PHPOffice/PhpSpreadsheet/pull/3001)
5151
- Eliminate partial dependency on php-intl in StringHelper [Issue #2982](https://github.com/PHPOffice/PhpSpreadsheet/issues/2982) [PR #2994](https://github.com/PHPOffice/PhpSpreadsheet/pull/2994)
5252
- Minor changes for Pdf [Issue #2999](https://github.com/PHPOffice/PhpSpreadsheet/issues/2999) [PR #3002](https://github.com/PHPOffice/PhpSpreadsheet/pull/3002) [PR #3006](https://github.com/PHPOffice/PhpSpreadsheet/pull/3006)
53+
- Html/Pdf Do net set background color for cells using (default) nofill [PR #3016](https://github.com/PHPOffice/PhpSpreadsheet/pull/3016)
54+
- Add support for Date Axis to Chart [Issue #2967](https://github.com/PHPOffice/PhpSpreadsheet/issues/2967) [PR #3018](https://github.com/PHPOffice/PhpSpreadsheet/pull/3018)
55+
- Reconcile Differences Between Css and Excel for Cell Alignment [PR #3048](https://github.com/PHPOffice/PhpSpreadsheet/pull/3048)
56+
- R1C1 Format Internationalization and Better Support for Relative Offsets [Issue #1704](https://github.com/PHPOffice/PhpSpreadsheet/issues/1704) [PR #3052](https://github.com/PHPOffice/PhpSpreadsheet/pull/3052)
57+
- Minor Fix for Percentage Formatting [Issue #1929](https://github.com/PHPOffice/PhpSpreadsheet/issues/1929) [PR #3053](https://github.com/PHPOffice/PhpSpreadsheet/pull/3053)
5358

5459
## 1.24.1 - 2022-07-18
5560

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
8282
"dompdf/dompdf": "^1.0 || ^2.0",
8383
"friendsofphp/php-cs-fixer": "^3.2",
84-
"mitoteam/jpgraph": "10.2.3",
84+
"mitoteam/jpgraph": "10.2.4",
8585
"mpdf/mpdf": "8.1.1",
8686
"phpcompatibility/php-compatibility": "^9.3",
8787
"phpstan/phpstan": "^1.1",

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra/LocaleGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected function buildFunctionsFileForLocale($column, $locale): void
146146
$translationValue = $translationCell->getValue();
147147
if ($this->isFunctionCategoryEntry($translationCell)) {
148148
$this->writeFileSectionHeader($functionFile, "{$translationValue} ({$functionName})");
149-
} elseif (!array_key_exists($functionName, $this->phpSpreadsheetFunctions)) {
149+
} elseif (!array_key_exists($functionName, $this->phpSpreadsheetFunctions) && substr($functionName, 0, 1) !== '*') {
150150
$this->log("Function {$functionName} is not defined in PhpSpreadsheet");
151151
} elseif (!empty($translationValue)) {
152152
$functionTranslation = "{$functionName} = {$translationValue}" . self::EOL;

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3110,7 +3110,7 @@ public function setLocale(string $locale)
31103110
[$localeFunction] = explode('##', $localeFunction); // Strip out comments
31113111
if (strpos($localeFunction, '=') !== false) {
31123112
[$fName, $lfName] = array_map('trim', explode('=', $localeFunction));
3113-
if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
3113+
if ((substr($fName, 0, 1) === '*' || isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
31143114
self::$localeFunctions[$fName] = $lfName;
31153115
}
31163116
}

src/PhpSpreadsheet/Calculation/LookupRef/Address.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
66
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
7+
use PhpOffice\PhpSpreadsheet\Cell\AddressHelper;
78
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
89

910
class Address
@@ -72,6 +73,9 @@ public static function cell($row, $column, $relativity = 1, $referenceStyle = tr
7273

7374
$sheetName = self::sheetName($sheetName);
7475

76+
if (is_int($referenceStyle)) {
77+
$referenceStyle = (bool) $referenceStyle;
78+
}
7579
if ((!is_bool($referenceStyle)) || $referenceStyle === self::REFERENCE_STYLE_A1) {
7680
return self::formatAsA1($row, $column, $relativity, $sheetName);
7781
}
@@ -113,7 +117,8 @@ private static function formatAsR1C1(int $row, int $column, int $relativity, str
113117
if (($relativity == self::ADDRESS_ROW_RELATIVE) || ($relativity == self::ADDRESS_RELATIVE)) {
114118
$row = "[{$row}]";
115119
}
120+
[$rowChar, $colChar] = AddressHelper::getRowAndColumnChars();
116121

117-
return "{$sheetName}R{$row}C{$column}";
122+
return "{$sheetName}$rowChar{$row}$colChar{$column}";
118123
}
119124
}

src/PhpSpreadsheet/Calculation/LookupRef/Helpers.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class Helpers
1313

1414
public const CELLADDRESS_USE_R1C1 = false;
1515

16-
private static function convertR1C1(string &$cellAddress1, ?string &$cellAddress2, bool $a1): string
16+
private static function convertR1C1(string &$cellAddress1, ?string &$cellAddress2, bool $a1, ?int $baseRow = null, ?int $baseCol = null): string
1717
{
1818
if ($a1 === self::CELLADDRESS_USE_R1C1) {
19-
$cellAddress1 = AddressHelper::convertToA1($cellAddress1);
19+
$cellAddress1 = AddressHelper::convertToA1($cellAddress1, $baseRow ?? 1, $baseCol ?? 1);
2020
if ($cellAddress2) {
21-
$cellAddress2 = AddressHelper::convertToA1($cellAddress2);
21+
$cellAddress2 = AddressHelper::convertToA1($cellAddress2, $baseRow ?? 1, $baseCol ?? 1);
2222
}
2323
}
2424

@@ -35,7 +35,7 @@ private static function adjustSheetTitle(string &$sheetTitle, ?string $value): v
3535
}
3636
}
3737

38-
public static function extractCellAddresses(string $cellAddress, bool $a1, Worksheet $sheet, string $sheetName = ''): array
38+
public static function extractCellAddresses(string $cellAddress, bool $a1, Worksheet $sheet, string $sheetName = '', ?int $baseRow = null, ?int $baseCol = null): array
3939
{
4040
$cellAddress1 = $cellAddress;
4141
$cellAddress2 = null;
@@ -52,7 +52,7 @@ public static function extractCellAddresses(string $cellAddress, bool $a1, Works
5252
if (strpos($cellAddress, ':') !== false) {
5353
[$cellAddress1, $cellAddress2] = explode(':', $cellAddress);
5454
}
55-
$cellAddress = self::convertR1C1($cellAddress1, $cellAddress2, $a1);
55+
$cellAddress = self::convertR1C1($cellAddress1, $cellAddress2, $a1, $baseRow, $baseCol);
5656

5757
return [$cellAddress1, $cellAddress2, $cellAddress];
5858
}

src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
88
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
99
use PhpOffice\PhpSpreadsheet\Cell\Cell;
10+
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
1011
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
1112

1213
class Indirect
@@ -63,6 +64,8 @@ private static function validateAddress($cellAddress): string
6364
*/
6465
public static function INDIRECT($cellAddress, $a1fmt, Cell $cell)
6566
{
67+
[$baseCol, $baseRow] = Coordinate::indexesFromString($cell->getCoordinate());
68+
6669
try {
6770
$a1 = self::a1Format($a1fmt);
6871
$cellAddress = self::validateAddress($cellAddress);
@@ -78,7 +81,11 @@ public static function INDIRECT($cellAddress, $a1fmt, Cell $cell)
7881
$cellAddress = self::handleRowColumnRanges($worksheet, ...explode(':', $cellAddress));
7982
}
8083

81-
[$cellAddress1, $cellAddress2, $cellAddress] = Helpers::extractCellAddresses($cellAddress, $a1, $cell->getWorkSheet(), $sheetName);
84+
try {
85+
[$cellAddress1, $cellAddress2, $cellAddress] = Helpers::extractCellAddresses($cellAddress, $a1, $cell->getWorkSheet(), $sheetName, $baseRow, $baseCol);
86+
} catch (Exception $e) {
87+
return ExcelError::REF();
88+
}
8289

8390
if (
8491
(!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/miu', $cellAddress1, $matches)) ||
Binary file not shown.

src/PhpSpreadsheet/Calculation/locale/da/functions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ ROWS = RÆKKER
245245
RTD = RTD
246246
TRANSPOSE = TRANSPONER
247247
VLOOKUP = LOPSLAG
248+
*RC = RK
248249

249250
##
250251
## Matematiske og trigonometriske funktioner (Math & Trig Functions)

0 commit comments

Comments
 (0)