numberFormat with 3 decimals

Topics: User Forum
Oct 27, 2014 at 3:43 PM
Edited Oct 27, 2014 at 3:44 PM
Hello everyone,

For work, I wrote a php script which create an excel file with numbers.
Some are 2 decimals numbers, some others are 3 decimals numbers.

I would like that Excel, when I open my generated file, doesn't tell me that the cells are fill with text formated numbers when I have 3 decimals.
I can't find the correct code to use to have those 3 damn decimals.
I surched in various forums and I can't find anybody who has the same problem.

Here is an example :
        $sheet->setCellValue("A1", 3.456);
        $sheet->getStyle("A1")->applyFromArray(array(
        'borders' => array(
            'allborders' => array(
                'style' => PHPExcel_Style_Border::BORDER_THIN,
                'color' => array('rgb' => '000000')
            )
        ),
        'alignment' => array(
            'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
            'vertical' => PHPExcel_Style_Alignment::VERTICAL_TOP,
            'wrap' => true
        ),
        'numberformat' => array(
            "code" => '0.000'
        )
    ));
can you help me to find the correct format code to use for this purpose please ?

Thank you in advance
Oct 27, 2014 at 3:57 PM
I'm really sorry everyone,

my falt !

I was writing an already formated number and Excel couldn't process it correctly.

the code 0.000 is correct and working.