Handle the case of an invalid formula by defaulting to ptgInt + 0, which will avoid breaking the file
This commit is contained in:
parent
83161de91e
commit
a6e792082b
|
|
@ -102,9 +102,9 @@ $expressionWizard->expression('ISEVEN(A1)')
|
|||
->setStyle($yellowStyle);
|
||||
$conditionalStyles[] = $expressionWizard->getConditional();
|
||||
|
||||
//$spreadsheet->getActiveSheet()
|
||||
// ->getStyle($expressionWizard->getCellRange())
|
||||
// ->setConditionalStyles($conditionalStyles);
|
||||
$spreadsheet->getActiveSheet()
|
||||
->getStyle($expressionWizard->getCellRange())
|
||||
->setConditionalStyles($conditionalStyles);
|
||||
|
||||
// Set rules for Sales Grid Row match against Country Comparison
|
||||
$cellRange = 'A17:D22';
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@ class ConditionalHelper
|
|||
$formula = Wizard\WizardAbstract::reverseAdjustCellRef((string) $condition, $cellRange);
|
||||
$this->parser->parse($formula);
|
||||
$this->tokens = $this->parser->toReversePolish();
|
||||
$this->size = strlen($this->tokens);
|
||||
$this->size = strlen($this->tokens ?? '');
|
||||
} catch (PhpSpreadsheetException $e) {
|
||||
var_dump("PARSER EXCEPTION: {$e->getMessage()}");
|
||||
$this->tokens = null;
|
||||
$this->size = 0;
|
||||
// In the event of a parser error with a formula value, we set the expression to ptgInt + 0
|
||||
$this->tokens = pack('Cv', 0x1E, 0);
|
||||
$this->size = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2787,8 +2787,8 @@ class Worksheet extends BIFFwriter
|
|||
string $cellRange
|
||||
): void {
|
||||
$record = 0x01B1; // Record identifier
|
||||
$type = null; // Type of the CF
|
||||
$operatorType = null; // Comparison operator
|
||||
$type = null; // Type of the CF
|
||||
$operatorType = null; // Comparison operator
|
||||
|
||||
if ($conditional->getConditionType() == Conditional::CONDITION_EXPRESSION) {
|
||||
$type = 0x02;
|
||||
|
|
|
|||
Loading…
Reference in New Issue