I am generating one report but it is showing error message with values like 23,222 or values with % symbol.It is showing error as numbers stored as text.Manually i am converting there values to Number.I need a solution for this.
My code is :-
Harsh
My code is :-
include_once("system/application/libraries/PHP_Excel/PHPExcel.php");
$excel = new PHPExcel(); // Create the object
$rowval = explode("\n",$data); // Splitting the data to get the rows
$rowcount = count($rowval); // Getting the count of rows
$colcount = count($fields); // Getting the field/column count
// Write the heading value to the xl sheet start
for($col = 0; $col < $colcount; $col++){
$excel->getActiveSheet()->setCellValueByColumnAndRow($col, 1, $fields[$col]);
}
// style array for the heading
$styleArray = array(
'font' => array(
'bold' => true,
)
); // style array for the heading
// applying style for the heading to the entire first row
$excel->getActiveSheet()->getStyle('A1:XFD1')->applyFromArray($styleArray);
// Write the values to the xl sheet
for($i = 0; $i < $rowcount; $i++){
$cellval = explode("\t", $rowval[$i]);
$colcount = count($cellval);
for($j = 0; $j < $colcount; $j++){
if(!empty($cellval[$j])){
$excel->getActiveSheet()->setCellValueByColumnAndRow($j, ($i+2), $cellval[$j]);
}
}
}
$objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
ThanksHarsh