Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: solution for numbers stored as text

$
0
0
I have included AdvancedValueBinder.php
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() ); in my code and it is working fine for all :)
except number format like 23,222.

I have included below code in AdvancedValueBinder.php .But still it is showing error ico with salary.

// Style logic - Numbers
    if ($dataType === PHPExcel_Cell_DataType::TYPE_NUMERIC) {
        // Leading zeroes?
        if (preg_match('/^\d+,\d+$/', $value)) {
            // Convert value to string
            $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_STRING);

            // Set style
            $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1 );

            return true;
        }
    } 
Please look into it

Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>