Skip to content

Commit bc8caf4

Browse files
committed
fix date formats; update dependencies
1 parent 8dfa3d4 commit bc8caf4

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@
2525
"ext-zip": "*",
2626
"ext-json": "*",
2727
"ext-mbstring": "*",
28-
"ext-intl": "*",
2928
"ext-xmlreader": "*",
3029
"ext-dom": "*",
3130
"avadim/fast-excel-helper": "^1.2",
32-
"avadim/fast-excel-writer": "^5.5.2",
33-
"avadim/fast-excel-reader": "^2.16"
31+
"avadim/fast-excel-writer": "^6.1",
32+
"avadim/fast-excel-reader": "^2.20"
3433
},
3534
"require-dev": {
3635
"phpunit/phpunit": "^9.0"

src/FastExcelTemplator/Sheet.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct($sheetName, $sheetId, $file, $path, $excel)
6262
*/
6363
public function path(): string
6464
{
65-
return $this->path;
65+
return $this->pathInZip;
6666
}
6767

6868
/**
@@ -250,7 +250,7 @@ protected function getRowTemplateReader(int $rowNumberMin, int $rowNumberMax): R
250250
}
251251
if (empty($this->rowTemplateReader)) {
252252
$this->rowTemplateReader = Excel::createReader($this->zipFilename);
253-
$this->rowTemplateReader->openZip($this->path);
253+
$this->rowTemplateReader->openZip($this->path());
254254
}
255255

256256
return $this->rowTemplateReader;
@@ -480,10 +480,6 @@ private function _writeWithStyle($cellAddress, $cellAddressIdx, $cellData)
480480
if (!empty($cellData['f'])) {
481481
$this->sheetWriter->_writeToCellByIdx($cellAddressIdx, $cellData['f']);
482482
}
483-
elseif ($cellData['t'] === 'date' && is_numeric($cellData['o'])) {
484-
$this->sheetWriter->_writeToCellByIdx($cellAddressIdx, $cellData['o']);
485-
$numberFormatType = 'n_auto';
486-
}
487483
else {
488484
if ($cellData['t'] === 'date') {
489485
$pattern = $this->excel->getDateFormatPattern($cellData['s']);

tests/FastExcelTemplatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function test03()
140140
$this->assertEquals($c0, $c1);
141141

142142
$c1 = $cells['C10'];unset($c1['s']);
143-
$c0 = ['v' => '=SUM(C2:C9)', 'f' => '=SUM(C2:C9)', 'o' => '=SUM(C2:C9)', 't' => ''];
143+
$c0 = ['v' => '=SUM(C2:C9)', 'f' => '=SUM(C2:C9)', 'o' => '=SUM(C2:C9)', 't' => 'number'];
144144
$this->assertEquals($c0, $c1);
145145

146146
unlink($out);

0 commit comments

Comments
 (0)