R
R
rudejah2015-01-06 10:52:02
PHP
rudejah, 2015-01-06 10:52:02

How to make PHPExcell return the correct field?

Good morning, I guess.
After reading the file using PHPExcel, I ran into a problem that it converts a bank account (20 digits) into an exponent (since Excel only likes 15 digit lines)
I tried to getFormattedValue, but somehow everything was unsuccessful.
Can you tell me in which direction to pick?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
rudejah, 2015-01-12
@rudejah

After breaking my head, looking at what var_dump produces with different configurations.
I did not find anything better than to change a little code in the PHPExcel/Cell.php file: We are
looking for public function setValueExplicit, in it we change
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_value = (float)$pValue;
on
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_value = (string)$pValue;
But this is only for my case and is not a panacea.

D
Dmitry, 2015-01-06
@thewind

have you tried getCalculatedValue?

K
Kamaz541, 2016-11-06
@Kamaz541

you can do this:
$number = 0012;
$sheet->setCellValue("B1", $number);
$sheet->getStyle("B1")->getNumberFormat()->setFormatCode('0000');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question