Somewhere in my program my phpexcel
looks like this:
$objPHPExcel = new PHPExcel();
foreach($arrayRawData as $HwKeyColumn => $arrayHwData){
$objPHPExcel->setActiveSheetIndex($counter)
-> setCellValue($Header2 . $HeaderCol , $HwKeyColumn);
$objPHPExcel->getActiveSheet()->setTitle($mode);
}
foreach($arrayRawData as $HwKeyColumn => $arrayHwData){
foreach($arrayHwData as $id => $value){
$objPHPExcel->setActiveSheetIndex($counter)
-> setCellValue($Header . $HeaderCol2,$value);
}
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('Report.xlsx');
I removed the incrementing of cell. It is working correctly. As I manage to save into my Excel with all data intact and no errors in placement.
My problem is in the most inner loop. The $value
would for example have a value PHYSICALLY DEFECTIVE˜
. But when it saves in the Excel. It is displayed as PHYSICALLY DEFECTIVE
. The ~
is missing. I need to also grab that for error trapping purpose.
I tried to echo $value
and surely it echoes PHYSICALLY DEFECTIVE˜
. I also tried getting the original value of $value
and passed it to a new variable. So it now is a new variable with value of PHYSICALLY DEFECTIVE˜
but still when it saves it becomes PHYSICALLY DEFECTIVE
.
//edit
But when I hardcode it like $value = 'PHYSICALLY DEFECTIVE˜'
; The Excell will display correctly. But if I leave it for the loop to change the value of $value it removes ~