douzhao5656 2019-07-18 07:47
浏览 425

setCellValue PhpSpreadsheet输出不正确

i set setCellValue in my phpspreadsheet example

$objPHPExcel->getActiveSheet()->setCellValue('A1'.'3209134102750009');

and then the output in xlsx when iam already downloaded is 3209134102750000

why always replace with 0 at the last?

i tried to changed set format code

setFormatCode(PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);

or setFormatCode(PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);

but not working, the output still not correct.. please help..

please don't suggest me to add ' at the first number ('3209134102750009) cause it make output still have '

  • 写回答

1条回答 默认 最新

  • douya2433 2019-07-19 02:52
    关注

    already fixed!!

    i add more function after value

    ,PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
    

    so

    $objPHPExcel->getActiveSheet()->setCellValueExplicit('A1','3209134102750009',PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
    

    Thank you

    评论

报告相同问题?