Merge ac2342b26028eafe1cf6de25ebe5f969a85dd766 into 84596668410bea89d21aa9867b91e1550e359329
This commit is contained in:
commit
ccb7bdb162
@ -139,6 +139,9 @@ class Cell
|
||||
*/
|
||||
protected function detectType($value)
|
||||
{
|
||||
if (CellTypeHelper::isFormula($value)) {
|
||||
return self::TYPE_FORMULA;
|
||||
}
|
||||
if (CellTypeHelper::isBoolean($value)) {
|
||||
return self::TYPE_BOOLEAN;
|
||||
}
|
||||
@ -198,6 +201,14 @@ class Cell
|
||||
return $this->type === self::TYPE_DATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isFormula()
|
||||
{
|
||||
return $this->type === self::TYPE_FORMULA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -60,9 +60,19 @@ class CellTypeHelper
|
||||
*/
|
||||
public static function isDateTimeOrDateInterval($value)
|
||||
{
|
||||
return (
|
||||
$value instanceof \DateTimeInterface ||
|
||||
return ($value instanceof \DateTimeInterface ||
|
||||
$value instanceof \DateInterval
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given value looks like a formula
|
||||
*
|
||||
* @param $value
|
||||
* @return bool whether the given value looks like a formula
|
||||
*/
|
||||
public static function isFormula($value)
|
||||
{
|
||||
return (is_array($value) || strpos($value, '=') === 0);
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ EOD;
|
||||
* @throws InvalidArgumentException If the given value cannot be processed
|
||||
* @return RegisteredStyle
|
||||
*/
|
||||
private function applyStyleAndRegister(Cell $cell, Style $rowStyle) : RegisteredStyle
|
||||
private function applyStyleAndRegister(Cell $cell, Style $rowStyle): RegisteredStyle
|
||||
{
|
||||
$isMatchingRowStyle = false;
|
||||
if ($cell->getStyle()->isEmpty()) {
|
||||
@ -228,7 +228,13 @@ EOD;
|
||||
$cellXML = '<c r="' . $columnLetters . $rowIndexOneBased . '"';
|
||||
$cellXML .= ' s="' . $styleId . '"';
|
||||
|
||||
if ($cell->isString()) {
|
||||
if ($cell->isFormula()) {
|
||||
if (is_array($cell->getValue())) {
|
||||
$cellXML .= ' ><f>' . substr($cell->getValue()[0], 1) . '</f><v>' . $cell->getValue()[1] . '</v></c>';
|
||||
} else {
|
||||
$cellXML .= ' ><f>' . substr($cell->getValue(), 1) . '</f></c>';
|
||||
}
|
||||
} elseif ($cell->isString()) {
|
||||
$cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue());
|
||||
} elseif ($cell->isBoolean()) {
|
||||
$cellXML .= ' t="b"><v>' . (int) ($cell->getValue()) . '</v></c>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user