accounting format - $ on left of cell and 0.00 on right of cell

Topics: Developer Forum, Project Management Forum, User Forum
Feb 5, 2014 at 5:53 PM
I have spent an hour searching online, no solution works, I even defined a new constant

I need to make certain cells with the Dollar sign aligned left and the numbers aligned on the right.

Is this possible? If yes, please provide exact complete code and instructions on what page to add it to
Feb 6, 2014 at 3:09 PM
Edited Feb 6, 2014 at 3:11 PM
I found it out.

first open PHPExcel_1 > Classes > PHPExcel > Style > NumberFormat.php

and within this class
class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable

// Add this
const FORMAT_ACCOUNTING                 = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';

then when exporting your excel sheet you now have a new number format
             'code' => PHPExcel_Style_NumberFormat::FORMAT_ACCOUNTING
One very important Item to Note!!!

This only works in Excel iteself, not open office

If you are using open office, it will not display the number format like excel does.... so dont do what I did going in cricles thinking it wasn't working, once I opended my document in excel, I saw that the format was correct
Marked as answer by justinbl on 2/6/2014 at 7:11 AM