currency formatting

Topics: User Forum
Sep 29, 2009 at 11:59 PM
Edited Sep 30, 2009 at 12:29 AM

Removed, solved it, sorry.

Developer
Sep 30, 2009 at 12:34 AM

Hmm.. this is strange. Your code is working for me.

$objPHPExcel = new PHPExcel();

$objPHPExcel->getActiveSheet()->getCell("A1")->setValueExplicit(1000.25, PHPExcel_Cell_DataType::TYPE_NUMERIC);
$objPHPExcel->getActiveSheet()->getStyle("A1")->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);

// make column a bit wider
$objPHPExcel->getActiveSheet()->getColumnDimension("A")->setWidth(20);

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('write.xlsx');