Skip to content

Commit f024259

Browse files
authored
Merge branch 'master' into Ods-Writer-Freeze-Pane
2 parents 76f486d + 0afec91 commit f024259

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

CHANGELOG.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2020

2121
This functionality is locale-aware, using the server's locale settings to identify the thousands and decimal separators.
2222

23-
- Support for two cell anchor drawing of images. [#2532](https://github.com/PHPOffice/PhpSpreadsheet/pull/2532)
23+
- Support for two cell anchor drawing of images. [#2532](https://github.com/PHPOffice/PhpSpreadsheet/pull/2532) [#2674](https://github.com/PHPOffice/PhpSpreadsheet/pull/2674)
2424
- Limited support for Xls Reader to handle Conditional Formatting:
2525

2626
Ranges and Rules are read, but style is currently limited to font size, weight and color; and to fill style and color.
2727

28+
- Add ability to suppress Mac line ending check for CSV [#2623](https://github.com/PHPOffice/PhpSpreadsheet/pull/2623)
29+
2830
### Changed
2931

3032
- Gnumeric Reader now loads number formatting for cells.
@@ -76,16 +78,20 @@ and this project adheres to [Semantic Versioning](https://semver.org).
7678
- Fix bug in Conditional Formatting in the Xls Writer that resulted in a broken file when there were multiple conditional ranges in a worksheet.
7779
- Fix Conditional Formatting in the Xls Writer to work with rules that contain string literals, cell references and formulae.
7880
- Fix for setting Active Sheet to the first loaded worksheet when bookViews element isn't defined [Issue #2666](https://github.com/PHPOffice/PhpSpreadsheet/issues/2666) [PR #2669](https://github.com/PHPOffice/PhpSpreadsheet/pull/2669)
79-
- Fixed behaviour of XLSX font style vertical align settings.
81+
- Fixed behaviour of XLSX font style vertical align settings [PR #2619](https://github.com/PHPOffice/PhpSpreadsheet/pull/2619)
8082
- Resolved formula translations to handle separators (row and column) for array functions as well as for function argument separators; and cleanly handle nesting levels.
8183

8284
Note that this method is used when translating Excel functions between `en_us` and other locale languages, as well as when converting formulae between different spreadsheet formats (e.g. Ods to Excel).
8385

8486
Nor is this a perfect solution, as there may still be issues when function calls have array arguments that themselves contain function calls; but it's still better than the current logic.
8587
- Fix for escaping double quotes within a formula [Issue #1971](https://github.com/PHPOffice/PhpSpreadsheet/issues/1971) [PR #2651](https://github.com/PHPOffice/PhpSpreadsheet/pull/2651)
88+
- Change open mode for output from `wb+` to `wb` [Issue #2372](https://github.com/PHPOffice/PhpSpreadsheet/issues/2372) [PR #2657](https://github.com/PHPOffice/PhpSpreadsheet/pull/2657)
89+
- Use color palette if supplied [Issue #2499](https://github.com/PHPOffice/PhpSpreadsheet/issues/2499) [PR #2595](https://github.com/PHPOffice/PhpSpreadsheet/pull/2595)
90+
- Xls reader treat drawing offsets as int rather than float [PR #2648](https://github.com/PHPOffice/PhpSpreadsheet/pull/2648)
91+
- Handle booleans in conditional styles properly [PR #2654](https://github.com/PHPOffice/PhpSpreadsheet/pull/2654)
92+
- Fix for reading files in the root directory of a ZipFile, which should not be prefixed by relative paths ("./") as dirname($filename) does by default.
8693
- Fix invalid style of cells in empty columns with columnDimensions and rows with rowDimensions in added external sheet. [PR #2739](https://github.com/PHPOffice/PhpSpreadsheet/pull/2739)
8794

88-
8995
## 1.22.0 - 2022-02-18
9096

9197
### Added

src/PhpSpreadsheet/Reader/Xlsx.php

+3
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ private function getFromZipArchive(ZipArchive $archive, $fileName = '')
368368
if (strpos($fileName, '//') !== false) {
369369
$fileName = substr($fileName, strpos($fileName, '//') + 1);
370370
}
371+
// Relative paths generated by dirname($filename) when $filename
372+
// has no path (i.e.files in root of the zip archive)
373+
$fileName = (string) preg_replace('/^\.\//', '', $fileName);
371374
$fileName = File::realpath($fileName);
372375

373376
// Sadly, some 3rd party xlsx generators don't use consistent case for filenaming
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
4+
5+
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
6+
use PHPUnit\Framework\TestCase;
7+
8+
class XlsxRootZipFilesTest extends TestCase
9+
{
10+
/**
11+
* @var string
12+
*/
13+
private static $testbook = 'tests/data/Reader/XLSX/rootZipFiles.xlsx';
14+
15+
public function testXlsxRootZipFiles(): void
16+
{
17+
$filename = self::$testbook;
18+
$reader = new Xlsx();
19+
$spreadsheet = $reader->load($filename);
20+
$sheet = $spreadsheet->getActiveSheet();
21+
$value = $sheet->getCell('A1')->getValue();
22+
self::assertSame('TEST CELL', $value->getPlainText());
23+
}
24+
}
3.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)