Les fonctions Excel se montrent comme lors de la conversion Excel en CSV en php

Nous convertions excel sur CSV avec chaque feuille. Par exemple, si un file excel comporte 5 feuilles, nous convertions 5 files CSV pour chaque feuille. Il fonctionne bien sauf une chose. Comme nous le soaps, Excel Sheet a quelques formules pour calculer comme sum, Moyenne, etc. … Alors, lorsque nous les convertions en file CSV, la fonction est alors affichée, sa valeur calculée ne s'affiche pas, que nous pouvons lire en tant que feuille de calcul Excel.

C'est la fonction que nous utilisons

function write_csv($filename,$definename){ $dir = ""; $file_arr = array(); array_push($file_arr, $filename); // Make CSV File $list = array(); foreach($file_arr as $val) { $arr_data = array(); // echo $val; $objPHPExcel = PHPExcel_IOFactory::load($dir . $val); // print_r($objPHPExcel->getSheetNames());exit; $loadedSheetNames = $objPHPExcel->getSheetNames(); foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { // echo $sheetIndex; $objPHPExcel->setActiveSheetIndex($sheetIndex); $fp = fopen($definename.'_'.$sheetIndex.'.csv', 'a'); $cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection(); // print_r($cell_collection); foreach($cell_collection as $cell) { $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn(); $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow(); $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue(); //header will / should be in row 1 only. of course this can be modified to suit your need. // Skip Rows From Top if you have header in Excel then Change 0 to 1 if($row == 0) { $header[$row][$column] = $data_value; } else { $arr_data[$row]['row'] = $row; $arr_data[$row][$column] = $data_value; } } $data = $arr_data; foreach($data as $val1) { $num_col = sizeof($val1) - 1; // get number of columns in Excel break; } $lwrcol=array(); foreach($data as $val2) { $alphaArr = range('A','Z'); $colArr = range('A',$alphaArr[$num_col - 1]); foreach($colArr as $col) { $lwrcol[$col] = isset($val2[$col]) ? utf8_decode($val2[$col]) : ""; fwrite($fp,$lwrcol[$col].","); } fwrite($fp,"\n"); } // chmod(getcwd()."/file.csv", 0777); fclose($fp); } } } 

Veuillez me dire ce que nous faisons mal.

Code complet:

http://pastebin.com/DaRBSpqP