This is:
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
Formatted value in accordance with the format 000\.00\.000\.0
Example: if value 11020011 and format code 000\.00\.000\.0 i wait formatted value 011.02.001.1
Excel:
value 2010035
format 000\.00\.000\.0
dispay 002.01.003.5
PhpSpreadscheet:
value 2010035
format code 000\\.00\\.000\\.0
formatted value 2010035.00.2010035.00
Example Excel file https://drive.google.com/file/d/1P_3K_x-pL_GlW7xxBxZC3qgcYCFirzKr/view?usp=sharing
There is only one cell in the file with data 2010035 and format 000\.00\.000\.0
<?php
require __DIR__ . '/vendor/autoload.php';
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadsheet = $reader->load($pFilename)->getActiveSheet();
echo $spreadsheet->getCellByColumnAndRow(1, 1)->getValue();
// 2010035
echo $spreadsheet->getCellByColumnAndRow(1, 1)->getStyle()->getNumberFormat()->getFormatCode();
// 000\\.00\\.000\\.0
echo $spreadsheet->getCellByColumnAndRow(1, 1)->getFormattedValue();
// 2010035.00.2010035.00
PHP 7.1
PhpSpreadscheet 1.6.0, 1.7.0, 1.8.2
The problem is the . character; the code is only testing for the presence of a . without looking to see if it's escaped... it'll take me a while to modify the block of code that handles "special" formatting masks
resolved in master branch
resolved in master
@MarkBaker thanks! I checked on the master branch - it works as expected!
Most helpful comment
resolved in master