Custom Date Format Possible Bug?

Topics: Developer Forum
Sep 27, 2011 at 9:52 PM
Edited Sep 28, 2011 at 3:00 AM

Hello,

I have a short function that converts a local excel document (2003) into HTML, see below: 

		/*
		*	Convert a local Excel file to HTML and return HTML:
		*/
		public static function getConvertExcelToHTML($filename) {

			//Needs IO Factory
			require_once 'PHPExcel/IOFactory.php';

			//Check to make sure file exists
			if (!file_exists($filename)) {
				appCore::error("Cannot find $filename");
			}

			//Load File
			$objPHPExcel = PHPExcel_IOFactory::load($filename);

			//WRite the sheet to file
			$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');

			//Display Settings:
			$objPHPExcel->getActiveSheet()->setShowGridlines(false);

			//Get the active sheet
			$objWorksheet = $objPHPExcel->getActiveSheet();

			//Set writer to active sheet:
			$objWriter->setSheetIndex($objPHPExcel->getIndex($objWorksheet));

			$filename = str_replace('.xlsx', '.htm', $filename);
			$filename = str_replace('.xls', '.htm', $filename);
			$objWriter->save($filename);

			//Return the Cached file:
			return file_get_contents($filename);
		}

But for cells with a date format (i.e. "6 meses adelante"  (mmmm yyyy)) the PHPExcel garbles the output, please see image here with the excel VS PhpExcel (http://i54.tinypic.com/2wf21qw.jpg)

The excel document is here: http://www.bcentral.cl/estadisticas-economicas/operadores-financieros/xls/EOFResultado13092011.xls

My host is running PHP Version 5.2.17, Linux

Is this a bug or am I loading it wrong?

Thank you

Jared