Skip to content

Commit 8e3417d

Browse files
authored
Merge pull request #4424 from oleibman/issue4422
Fix Typo in Style exportArray quotePrefix
2 parents cd5836a + ae5583c commit 8e3417d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
3838
- Ignore fractional part of Drawing Shadow Alpha. [Issue #4415](https://github.com/PHPOffice/PhpSpreadsheet/issues/4415) [PR #4417](https://github.com/PHPOffice/PhpSpreadsheet/pull/4417)
3939
- BIN2DEC, OCT2DEC, and HEX2DEC return numbers rather than strings. [Issue #4383](https://github.com/PHPOffice/PhpSpreadsheet/issues/4383) [PR #4389](https://github.com/PHPOffice/PhpSpreadsheet/pull/4389)
4040
- Fix TREND_BEST_FIT_NO_POLY. [Issue #4400](https://github.com/PHPOffice/PhpSpreadsheet/issues/4400) [PR #4339](https://github.com/PHPOffice/PhpSpreadsheet/pull/4339)
41+
- Fix typo in Style exportArray quotePrefix. [Issue #4422](https://github.com/PHPOffice/PhpSpreadsheet/issues/4422) [PR #4424](https://github.com/PHPOffice/PhpSpreadsheet/pull/4424)
4142
- Tweak Spreadsheet clone. [PR #4419](https://github.com/PHPOffice/PhpSpreadsheet/pull/4419)
4243
- Better handling of Chart DisplayBlanksAs. [Issue #4411](https://github.com/PHPOffice/PhpSpreadsheet/issues/4411) [PR #4414](https://github.com/PHPOffice/PhpSpreadsheet/pull/4414)
4344

src/PhpSpreadsheet/Style/Style.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ protected function exportArray1(): array
698698
$this->exportArray2($exportedArray, 'font', $this->getFont());
699699
$this->exportArray2($exportedArray, 'numberFormat', $this->getNumberFormat());
700700
$this->exportArray2($exportedArray, 'protection', $this->getProtection());
701-
$this->exportArray2($exportedArray, 'quotePrefx', $this->getQuotePrefix());
701+
$this->exportArray2($exportedArray, 'quotePrefix', $this->getQuotePrefix());
702702

703703
return $exportedArray;
704704
}

tests/PhpSpreadsheetTests/Style/ExportArrayTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace PhpOffice\PhpSpreadsheetTests\Style;
66

7+
use PhpOffice\PhpSpreadsheet\Cell\DataType;
78
use PhpOffice\PhpSpreadsheet\Spreadsheet;
89
use PhpOffice\PhpSpreadsheet\Style\Alignment;
910
use PhpOffice\PhpSpreadsheet\Style\Border;
@@ -287,4 +288,24 @@ public function testFillColors(): void
287288
);
288289
$spreadsheet->disconnectWorksheets();
289290
}
291+
292+
public function testQuotePrefix(): void
293+
{
294+
$spreadsheet = new Spreadsheet();
295+
$sheet = $spreadsheet->getActiveSheet();
296+
$sheet->getCell('A1')
297+
->setValueExplicit('=1+2', DataType::TYPE_STRING);
298+
self::assertSame('=1+2', $sheet->getCell('A1')->getCalculatedValue());
299+
self::assertTrue($sheet->getStyle('A1')->getQuotePrefix());
300+
$sheet->getCell('A2')->setValue('=1+2');
301+
self::assertSame(3, $sheet->getCell('A2')->getCalculatedValue());
302+
self::assertFalse($sheet->getStyle('A2')->getQuotePrefix());
303+
$styleArray1 = $sheet->getStyle('A1')->exportArray();
304+
$styleArray2 = $sheet->getStyle('A2')->exportArray();
305+
$sheet->getStyle('B1')->applyFromArray($styleArray1);
306+
$sheet->getStyle('B2')->applyFromArray($styleArray2);
307+
self::assertTrue($sheet->getStyle('B1')->getQuotePrefix());
308+
self::assertFalse($sheet->getStyle('B2')->getQuotePrefix());
309+
$spreadsheet->disconnectWorksheets();
310+
}
290311
}

0 commit comments

Comments
 (0)