parent
7d4dc74fc6
commit
004a192922
|
@ -493,7 +493,7 @@ class DateTime
|
||||||
// Strip any ordinals because they're allowed in Excel (English only)
|
// Strip any ordinals because they're allowed in Excel (English only)
|
||||||
$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
|
$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
|
||||||
// Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
|
// Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
|
||||||
$dateValue = str_replace(['/', '.', '-', ' '], [' ', ' ', ' ', ' '], $dateValue);
|
$dateValue = str_replace(['/', '.', '-', ' '], ' ', $dateValue);
|
||||||
|
|
||||||
$yearFound = false;
|
$yearFound = false;
|
||||||
$t1 = explode(' ', $dateValue);
|
$t1 = explode(' ', $dateValue);
|
||||||
|
@ -520,7 +520,7 @@ class DateTime
|
||||||
$t1[1] += 1900;
|
$t1[1] += 1900;
|
||||||
array_unshift($t1, 1);
|
array_unshift($t1, 1);
|
||||||
} else {
|
} else {
|
||||||
array_push($t1, date('Y'));
|
$t1[] = date('Y');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ class DateTime
|
||||||
public static function TIMEVALUE($timeValue)
|
public static function TIMEVALUE($timeValue)
|
||||||
{
|
{
|
||||||
$timeValue = trim(Functions::flattenSingleValue($timeValue), '"');
|
$timeValue = trim(Functions::flattenSingleValue($timeValue), '"');
|
||||||
$timeValue = str_replace(['/', '.'], ['-', '-'], $timeValue);
|
$timeValue = str_replace(['/', '.'], '-', $timeValue);
|
||||||
|
|
||||||
$arraySplit = preg_split('/[\/:\-\s]/', $timeValue);
|
$arraySplit = preg_split('/[\/:\-\s]/', $timeValue);
|
||||||
if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) {
|
if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) {
|
||||||
|
|
|
@ -253,7 +253,7 @@ class FormulaParser
|
||||||
|
|
||||||
// establish state-dependent character evaluations
|
// establish state-dependent character evaluations
|
||||||
if ($this->formula[$index] == self::QUOTE_DOUBLE) {
|
if ($this->formula[$index] == self::QUOTE_DOUBLE) {
|
||||||
if (strlen($value > 0)) {
|
if (strlen($value) > 0) {
|
||||||
// unexpected
|
// unexpected
|
||||||
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
$tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||||
$value = '';
|
$value = '';
|
||||||
|
@ -593,7 +593,7 @@ class FormulaParser
|
||||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND &&
|
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND &&
|
||||||
$token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
$token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||||
if (!is_numeric($token->getValue())) {
|
if (!is_numeric($token->getValue())) {
|
||||||
if (strtoupper($token->getValue()) == 'TRUE' || strtoupper($token->getValue() == 'FALSE')) {
|
if (strtoupper($token->getValue()) == 'TRUE' || strtoupper($token->getValue()) == 'FALSE') {
|
||||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||||
} else {
|
} else {
|
||||||
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_RANGE);
|
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_RANGE);
|
||||||
|
@ -607,7 +607,7 @@ class FormulaParser
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) {
|
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||||
if (strlen($token->getValue() > 0)) {
|
if (strlen($token->getValue()) > 0) {
|
||||||
if (substr($token->getValue(), 0, 1) == '@') {
|
if (substr($token->getValue(), 0, 1) == '@') {
|
||||||
$token->setValue(substr($token->getValue(), 1));
|
$token->setValue(substr($token->getValue(), 1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ class LookupRef
|
||||||
if (is_array($cellAddress)) {
|
if (is_array($cellAddress)) {
|
||||||
foreach ($cellAddress as $columnKey => $rowValue) {
|
foreach ($cellAddress as $columnKey => $rowValue) {
|
||||||
foreach ($rowValue as $rowKey => $cellValue) {
|
foreach ($rowValue as $rowKey => $cellValue) {
|
||||||
return (int) preg_replace('/[^0-9]/i', '', $rowKey);
|
return (int) preg_replace('/[^0-9]/', '', $rowKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -650,16 +650,16 @@ class Ods extends BaseReader implements IReader
|
||||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||||
if ($tKey = !$tKey) {
|
if ($tKey = !$tKey) {
|
||||||
// Cell range reference in another sheet
|
// Cell range reference in another sheet
|
||||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value);
|
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/U', '$1!$2:$3', $value);
|
||||||
|
|
||||||
// Cell reference in another sheet
|
// Cell reference in another sheet
|
||||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value);
|
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/U', '$1!$2', $value);
|
||||||
|
|
||||||
// Cell range reference
|
// Cell range reference
|
||||||
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value);
|
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/U', '$1:$2', $value);
|
||||||
|
|
||||||
// Simple cell reference
|
// Simple cell reference
|
||||||
$value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value);
|
$value = preg_replace('/\[\.([^\.]+)\]/U', '$1', $value);
|
||||||
|
|
||||||
$value = Calculation::translateSeparator(';', ',', $value, $inBraces);
|
$value = Calculation::translateSeparator(';', ',', $value, $inBraces);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7073,7 +7073,7 @@ class Xls extends BaseReader implements IReader
|
||||||
// todo: check if we have identified the whole set of special characters
|
// todo: check if we have identified the whole set of special characters
|
||||||
// it seems that the following characters are not accepted for sheet names
|
// it seems that the following characters are not accepted for sheet names
|
||||||
// and we may assume that they are not present: []*/:\?
|
// and we may assume that they are not present: []*/:\?
|
||||||
if (preg_match("/[ !\"@#£$%&{()}<>=+'|^,;-]/", $sheetRange)) {
|
if (preg_match("/[ !\"@#£$%&{()}<>=+'|^,;-]/u", $sheetRange)) {
|
||||||
$sheetRange = "'$sheetRange'";
|
$sheetRange = "'$sheetRange'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ class Spreadsheet
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->uniqueID = uniqid();
|
$this->uniqueID = uniqid('', true);
|
||||||
$this->calculationEngine = new Calculation($this);
|
$this->calculationEngine = new Calculation($this);
|
||||||
|
|
||||||
// Initialise worksheet collection and add one worksheet
|
// Initialise worksheet collection and add one worksheet
|
||||||
|
|
|
@ -507,7 +507,7 @@ class NumberFormat extends Supervisor implements IComparable
|
||||||
if ($format === self::FORMAT_PERCENTAGE) {
|
if ($format === self::FORMAT_PERCENTAGE) {
|
||||||
$value = round((100 * $value), 0) . '%';
|
$value = round((100 * $value), 0) . '%';
|
||||||
} else {
|
} else {
|
||||||
if (preg_match('/\.[#0]+/i', $format, $m)) {
|
if (preg_match('/\.[#0]+/', $format, $m)) {
|
||||||
$s = substr($m[0], 0, 1) . (strlen($m[0]) - 1);
|
$s = substr($m[0], 0, 1) . (strlen($m[0]) - 1);
|
||||||
$format = str_replace($m[0], $s, $format);
|
$format = str_replace($m[0], $s, $format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -739,7 +739,7 @@ class Html extends BaseWriter implements IWriter
|
||||||
if ($chart instanceof Chart) {
|
if ($chart instanceof Chart) {
|
||||||
$chartCoordinates = $chart->getTopLeftPosition();
|
$chartCoordinates = $chart->getTopLeftPosition();
|
||||||
if ($chartCoordinates['cell'] == $coordinates) {
|
if ($chartCoordinates['cell'] == $coordinates) {
|
||||||
$chartFileName = File::sysGetTempDir() . '/' . uniqid() . '.png';
|
$chartFileName = File::sysGetTempDir() . '/' . uniqid('', true) . '.png';
|
||||||
if (!$chart->render($chartFileName)) {
|
if (!$chart->render($chartFileName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -978,9 +978,6 @@ class Html extends BaseWriter implements IWriter
|
||||||
*/
|
*/
|
||||||
private function createCSSStyle(Style $pStyle)
|
private function createCSSStyle(Style $pStyle)
|
||||||
{
|
{
|
||||||
// Construct CSS
|
|
||||||
$css = '';
|
|
||||||
|
|
||||||
// Create CSS
|
// Create CSS
|
||||||
$css = array_merge(
|
$css = array_merge(
|
||||||
$this->createCSSStyleAlignment($pStyle->getAlignment()),
|
$this->createCSSStyleAlignment($pStyle->getAlignment()),
|
||||||
|
@ -1235,7 +1232,6 @@ class Html extends BaseWriter implements IWriter
|
||||||
$cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : '';
|
$cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : '';
|
||||||
$coordinate = Cell::stringFromColumnIndex($colNum) . ($pRow + 1);
|
$coordinate = Cell::stringFromColumnIndex($colNum) . ($pRow + 1);
|
||||||
if (!$this->useInlineCss) {
|
if (!$this->useInlineCss) {
|
||||||
$cssClass = '';
|
|
||||||
$cssClass = 'column' . $colNum;
|
$cssClass = 'column' . $colNum;
|
||||||
} else {
|
} else {
|
||||||
$cssClass = [];
|
$cssClass = [];
|
||||||
|
@ -1541,8 +1537,7 @@ class Html extends BaseWriter implements IWriter
|
||||||
|
|
||||||
$color_regex = '/^\\[[a-zA-Z]+\\]/';
|
$color_regex = '/^\\[[a-zA-Z]+\\]/';
|
||||||
if (preg_match($color_regex, $pFormat, $matches)) {
|
if (preg_match($color_regex, $pFormat, $matches)) {
|
||||||
$color = str_replace('[', '', $matches[0]);
|
$color = str_replace(['[', ']'], '', $matches[0]);
|
||||||
$color = str_replace(']', '', $color);
|
|
||||||
$color = strtolower($color);
|
$color = strtolower($color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1438,7 +1438,6 @@ class Worksheet extends BIFFwriter
|
||||||
private function writeSelection()
|
private function writeSelection()
|
||||||
{
|
{
|
||||||
// look up the selected cell range
|
// look up the selected cell range
|
||||||
$selectedCells = $this->phpSheet->getSelectedCells();
|
|
||||||
$selectedCells = Cell::splitRange($this->phpSheet->getSelectedCells());
|
$selectedCells = Cell::splitRange($this->phpSheet->getSelectedCells());
|
||||||
$selectedCells = $selectedCells[0];
|
$selectedCells = $selectedCells[0];
|
||||||
if (count($selectedCells) == 2) {
|
if (count($selectedCells) == 2) {
|
||||||
|
|
|
@ -790,7 +790,7 @@ class Worksheet extends WriterPart
|
||||||
$objWriter->writeAttribute('ref', str_replace('$', '', $range));
|
$objWriter->writeAttribute('ref', str_replace('$', '', $range));
|
||||||
|
|
||||||
$columns = $pSheet->getAutoFilter()->getColumns();
|
$columns = $pSheet->getAutoFilter()->getColumns();
|
||||||
if (count($columns > 0)) {
|
if (count($columns) > 0) {
|
||||||
foreach ($columns as $columnID => $column) {
|
foreach ($columns as $columnID => $column) {
|
||||||
$rules = $column->getRules();
|
$rules = $column->getRules();
|
||||||
if (count($rules) > 0) {
|
if (count($rules) > 0) {
|
||||||
|
|
Loading…
Reference in New Issue