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

New Post: Cell format changing after deleting row

$
0
0

Hi All,

I'm having a little problem with a file that is generated using PHPExcel.  The site I am using pulls data from an SQL database and puts it on a spreadsheet.  Some of the data that is pulled are SKU numbers beginning with a 0.  When they are initially written to the sheet, the cells are formatted as text, and they display fine, but when it becomes necessary to delete a row, all the cells below the deleted line change back to default format, and SKU numbers beginning with 0 are no longer displaying correctly.  Below is the code snippet I have used to try to set the cells back to text format instead of numbers:

$objPHPExcel->getActiveSheet()->getStyle('B2:B500')->getNumberFormat()->setFormatCode(PHPExcel_Style_Numberformat::FORMAT_TEXT);
$objPHPExcel->getActiveSheet()->removeRow($cellRM);
$objPHPExcel->getActiveSheet()->getStyle('B2:B500')->getNumberFormat()->setFormatCode(PHPExcel_Style_Numberformat::FORMAT_TEXT);

And here is the snippet I used in a previous file to set the entire sheet to text:

$objPHPExcel->getDefaultStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);

Can anyone offer a suggestion for what I may be doing wrong, or perhaps if this is a bug?  

Thanks for reading!


Viewing all articles
Browse latest Browse all 2707

Trending Articles



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