Minor work on Excel2003XML Reader (not yet complete)
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@69208 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
bba779bfc3
commit
5b71914eea
|
@ -659,9 +659,23 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
}
|
||||
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'FORMULA<br />';
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
|
||||
if (substr($cellDataFormula,0,3) == 'of:') {
|
||||
$cellDataFormula = substr($cellDataFormula,3);
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
$value = str_replace(array('[.','.',']'),'',$value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
|
@ -690,9 +704,11 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
// echo 'After: ',$cellDataFormula,'<br />';
|
||||
}
|
||||
|
||||
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
|
||||
|
|
|
@ -35,7 +35,16 @@ require_once '../Classes/PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
echo date('H:i:s') . " Load from XML file\n";
|
||||
$objPHPExcel = PHPExcel_IOFactory::load("XMLTest.xml");
|
||||
$inputFileName = "XMLTest.xml";
|
||||
|
||||
/** Identify the type of $inputFileName **/
|
||||
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
|
||||
echo 'Loading ',$inputFileName,' using ',$inputFileType," Reader\n";
|
||||
|
||||
/** Create a new Reader of the type that has been identified **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Load $inputFileName to a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
|
||||
echo date('H:i:s') . " Write to Excel2007 format\n";
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
|
|
Loading…
Reference in New Issue