Skip to content

Commit

Permalink
fix date formats; update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aVadim483 committed Oct 22, 2024
1 parent 8dfa3d4 commit bc8caf4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
"ext-zip": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-intl": "*",
"ext-xmlreader": "*",
"ext-dom": "*",
"avadim/fast-excel-helper": "^1.2",
"avadim/fast-excel-writer": "^5.5.2",
"avadim/fast-excel-reader": "^2.16"
"avadim/fast-excel-writer": "^6.1",
"avadim/fast-excel-reader": "^2.20"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
Expand Down
8 changes: 2 additions & 6 deletions src/FastExcelTemplator/Sheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct($sheetName, $sheetId, $file, $path, $excel)
*/
public function path(): string
{
return $this->path;
return $this->pathInZip;
}

/**
Expand Down Expand Up @@ -250,7 +250,7 @@ protected function getRowTemplateReader(int $rowNumberMin, int $rowNumberMax): R
}
if (empty($this->rowTemplateReader)) {
$this->rowTemplateReader = Excel::createReader($this->zipFilename);
$this->rowTemplateReader->openZip($this->path);
$this->rowTemplateReader->openZip($this->path());
}

return $this->rowTemplateReader;
Expand Down Expand Up @@ -480,10 +480,6 @@ private function _writeWithStyle($cellAddress, $cellAddressIdx, $cellData)
if (!empty($cellData['f'])) {
$this->sheetWriter->_writeToCellByIdx($cellAddressIdx, $cellData['f']);
}
elseif ($cellData['t'] === 'date' && is_numeric($cellData['o'])) {
$this->sheetWriter->_writeToCellByIdx($cellAddressIdx, $cellData['o']);
$numberFormatType = 'n_auto';
}
else {
if ($cellData['t'] === 'date') {
$pattern = $this->excel->getDateFormatPattern($cellData['s']);
Expand Down
2 changes: 1 addition & 1 deletion tests/FastExcelTemplatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function test03()
$this->assertEquals($c0, $c1);

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

unlink($out);
Expand Down

0 comments on commit bc8caf4

Please sign in to comment.