diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php
index 05d053d..e1cef01 100644
--- a/Classes/PHPExcel/Reader/Excel2007.php
+++ b/Classes/PHPExcel/Reader/Excel2007.php
@@ -242,7 +242,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
private static function _castToBool($c) {
-// echo 'Initial Cast to Boolean
';
+// echo 'Initial Cast to Boolean', PHP_EOL;
$value = isset($c->v) ? (string) $c->v : NULL;
if ($value == '0') {
return FALSE;
@@ -256,46 +256,46 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
private static function _castToError($c) {
-// echo 'Initial Cast to Error
';
+// echo 'Initial Cast to Error', PHP_EOL;
return isset($c->v) ? (string) $c->v : NULL;
} // function _castToError()
private static function _castToString($c) {
-// echo 'Initial Cast to String
';
+// echo 'Initial Cast to String, PHP_EOL;
return isset($c->v) ? (string) $c->v : NULL;
} // function _castToString()
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
-// echo 'Formula',PHP_EOL;
-// echo '$c->f is '.$c->f.PHP_EOL;
+// echo 'Formula', PHP_EOL;
+// echo '$c->f is ', $c->f, PHP_EOL;
$cellDataType = 'f';
$value = "={$c->f}";
$calculatedValue = self::$castBaseType($c);
// Shared formula?
if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') {
-// echo 'SHARED FORMULA'.PHP_EOL;
+// echo 'SHARED FORMULA', PHP_EOL;
$instance = (string)$c->f['si'];
-// echo 'Instance ID = '.$instance.PHP_EOL;
+// echo 'Instance ID = ', $instance, PHP_EOL;
//
-// echo 'Shared Formula Array:'.PHP_EOL;
+// echo 'Shared Formula Array:', PHP_EOL;
// print_r($sharedFormulas);
if (!isset($sharedFormulas[(string)$c->f['si']])) {
-// echo 'SETTING NEW SHARED FORMULA'.PHP_EOL;
-// echo 'Master is '.$r.PHP_EOL;
-// echo 'Formula is '.$value.PHP_EOL;
+// echo 'SETTING NEW SHARED FORMULA', PHP_EOL;
+// echo 'Master is ', $r, PHP_EOL;
+// echo 'Formula is ', $value, PHP_EOL;
$sharedFormulas[$instance] = array( 'master' => $r,
'formula' => $value
);
-// echo 'New Shared Formula Array:'.PHP_EOL;
+// echo 'New Shared Formula Array:', PHP_EOL;
// print_r($sharedFormulas);
} else {
-// echo 'GETTING SHARED FORMULA'.PHP_EOL;
-// echo 'Master is '.$sharedFormulas[$instance]['master'].PHP_EOL;
-// echo 'Formula is '.$sharedFormulas[$instance]['formula'].PHP_EOL;
+// echo 'GETTING SHARED FORMULA', PHP_EOL;
+// echo 'Master is ', $sharedFormulas[$instance]['master'], PHP_EOL;
+// echo 'Formula is ', $sharedFormulas[$instance]['formula'], PHP_EOL;
$master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']);
$current = PHPExcel_Cell::coordinateFromString($r);
@@ -308,7 +308,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$difference[0],
$difference[1]
);
-// echo 'Adjusted Formula is '.$value.PHP_EOL;
+// echo 'Adjusted Formula is ', $value, PHP_EOL;
}
}
}
@@ -770,6 +770,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
//$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(TRUE);
}
if (self::boolean($col["hidden"])) {
+ echo PHPExcel_Cell::stringFromColumnIndex($i),': HIDDEN COLUMN',PHP_EOL;
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(FALSE);
}
if (self::boolean($col["collapsed"])) {
@@ -837,15 +838,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
}
- // echo 'Reading cell '.$coordinates[0].$coordinates[1].'
';
+ // echo 'Reading cell ', $coordinates[0], $coordinates[1], PHP_EOL;
// print_r($c);
- // echo '
';
- // echo 'Cell Data Type is '.$cellDataType.': ';
+ // echo PHP_EOL;
+ // echo 'Cell Data Type is ', $cellDataType, ': ';
//
// Read cell!
switch ($cellDataType) {
case "s":
- // echo 'String
';
+ // echo 'String', PHP_EOL;
if ((string)$c->v != '') {
$value = $sharedStrings[intval($c->v)];
@@ -858,7 +859,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
break;
case "b":
- // echo 'Boolean
';
+ // echo 'Boolean', PHP_EOL;
if (!isset($c->f)) {
$value = self::_castToBool($c);
} else {
@@ -869,41 +870,41 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$att = $c->f;
$docSheet->getCell($r)->setFormulaAttributes($att);
}
- // echo '$calculatedValue = '.$calculatedValue.'
';
+ // echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
}
break;
case "inlineStr":
- // echo 'Inline String
';
+ // echo 'Inline String', PHP_EOL;
$value = $this->_parseRichText($c->is);
break;
case "e":
- // echo 'Error
';
+ // echo 'Error', PHP_EOL;
if (!isset($c->f)) {
$value = self::_castToError($c);
} else {
// Formula
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError');
- // echo '$calculatedValue = '.$calculatedValue.'
';
+ // echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
}
break;
default:
- // echo 'Default
';
+ // echo 'Default', PHP_EOL;
if (!isset($c->f)) {
- // echo 'Not a Formula
';
+ // echo 'Not a Formula', PHP_EOL;
$value = self::_castToString($c);
} else {
- // echo 'Treat as Formula
';
+ // echo 'Treat as Formula', PHP_EOL;
// Formula
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString');
- // echo '$calculatedValue = '.$calculatedValue.'
';
+ // echo '$calculatedValue = ', $calculatedValue, PHP_EOL;
}
break;
}
- // echo 'Value is '.$value.'
';
+ // echo 'Value is ', $value, PHP_EOL;
// Check for numeric values
if (is_numeric($value) && $cellDataType != 's') {
@@ -2057,9 +2058,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
private static function boolean($value = NULL)
{
- if (is_numeric($value) || is_object($value)) {
+ if (is_object($value)) {
+ $value = (string) $value;
+ }
+ if (is_numeric($value)) {
return (bool) $value;
}
- return ($value === 'true' || $value === 'TRUE') ? TRUE : FALSE;
+ return ($value === 'true' || $value === 'TRUE');
}
}
diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php
index 01a34c1..ce30fc2 100644
--- a/Classes/PHPExcel/Reader/OOCalc.php
+++ b/Classes/PHPExcel/Reader/OOCalc.php
@@ -624,9 +624,10 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
foreach($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks)
if ($tKey = !$tKey) {
- $value = preg_replace('/\[(.+)\.(.*)\]/Ui','$1!$2',$value); // Cell reference in another sheet
- $value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value); // Cell range reference
- $value = preg_replace('/\[\.(.*)\]/Ui','$1',$value); // Simple cell reference
+ $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3',$value); // Cell range reference in another sheet
+ $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2',$value); // Cell reference in another sheet
+ $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2',$value); // Cell range reference
+ $value = preg_replace('/\[\.([^\.]+)\]/Ui','$1',$value); // Simple cell reference
$value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces);
}
}
diff --git a/Examples/06largescale-with-cellcaching-sqlite.php b/Examples/06largescale-with-cellcaching-sqlite.php
index 6d36d24..cbdb59b 100644
--- a/Examples/06largescale-with-cellcaching-sqlite.php
+++ b/Examples/06largescale-with-cellcaching-sqlite.php
@@ -38,8 +38,11 @@ date_default_timezone_set('Europe/London');
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite;
-PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
-echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
+ echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+} else {
+ echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
+}
// Create new PHPExcel object
diff --git a/Examples/06largescale-with-cellcaching-sqlite3.php b/Examples/06largescale-with-cellcaching-sqlite3.php
index 3642ce7..ca04f85 100644
--- a/Examples/06largescale-with-cellcaching-sqlite3.php
+++ b/Examples/06largescale-with-cellcaching-sqlite3.php
@@ -38,8 +38,11 @@ date_default_timezone_set('Europe/London');
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
-PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
-echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
+ echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+} else {
+ echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
+}
// Create new PHPExcel object
diff --git a/Examples/runall.php b/Examples/runall.php
index c686d4d..395e83e 100644
--- a/Examples/runall.php
+++ b/Examples/runall.php
@@ -43,6 +43,8 @@ $aTests = array(
, '05featuredemo.php'
, '06largescale.php'
, '06largescale-with-cellcaching.php'
+ , '06largescale-with-cellcaching-sqlite.php'
+ , '06largescale-with-cellcaching-sqlite3.php'
, '06largescale-xls.php'
, '07reader.php'
, '07readerPCLZip.php'
diff --git a/changelog.txt b/changelog.txt
index 8d93630..dd04248 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -49,6 +49,7 @@ Fixed in develop branch for release v1.8.0:
- Bugfix: (MBaker) Work Item CP20604 - Adding Sheet to Workbook Bug
- Bugfix: (MBaker) Work item CP20703 - Calculation engine incorrectly evaluates empty cells as #VALUE
- Bugfix: (MBaker) Work item CP20760 - Formula references to cell on another sheet in ODS files
+- Bugfix: (MBaker) Work item GH321,GH158,CP17824 - LibreOffice created XLSX files results in an empty file.
- Feature: (amerov) - Implementation of the Excel HLOOKUP() function
- Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only)
- Feature: (MBaker) - Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer