Skip to content

Commit

Permalink
ITST-16721 IPP xls2csv: wrong handling of custom format
Browse files Browse the repository at this point in the history
- adjust format matching, so that the custom format does correctly get replaced
- adapt test
  • Loading branch information
Athanasios Tsavlidis committed Jul 22, 2019
1 parent 38628f0 commit 87245aa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,8 @@ private function formatValue($value, $format_index)
} else {
$value = sprintf($format['Pattern'], $value);
}
$value = preg_replace('{(0+)(\.?)(0*)}', $value, $format['Code']);
$format_code = preg_replace('{\[\$.*\]}', '', $format['Code']);
$value = preg_replace('{(0+)(\.?)(0*)}', $value, $format_code);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/CellContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testCellContent()
$reader->close();

self::assertSame(
array('', 'Value', '0123', '0123', ' '),
array('', 'Value', '0123', '0123', ' ', '268.02'),
$output_cells,
'The retrieved sheet content was not as expected.'
);
Expand Down
Binary file modified tests/input_files/cell_content_test.xlsx
Binary file not shown.

0 comments on commit 87245aa

Please sign in to comment.