Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

parseFormula exception on mbstring named range #1197

Closed
Dfred opened this issue Apr 26, 2017 · 8 comments
Closed

parseFormula exception on mbstring named range #1197

Dfred opened this issue Apr 26, 2017 · 8 comments

Comments

@Dfred
Copy link

Dfred commented Apr 26, 2017

As confirmed by @MarkBaker, PHPExcel_Calculation::parseFormula() should handle multibyte named ranges. However the following call fails (cliché is a named range):

PHPExcel_Calculation::getInstance()->parseFormula('=cliché');

It throws a PHPExcel_Calculation_Exception with message

Formula Error: An unexpected error occured

@PowerKiKi
Copy link
Member

Could you provide a Minimal, Complete, and Verifiable example of code that exhibits this issue without the use of external file please ?

@Dfred
Copy link
Author

Dfred commented Apr 28, 2017

Is this good enough?

$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'kiki');
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange(html_entity_decode('cliché'), $objPHPExcel->getActiveSheet(), 'A1'));
PHPExcel_Calculation::getInstance($objPHPExcel)->parseFormula(html_entity_decode('=cliché'));

@PowerKiKi
Copy link
Member

thanks ! I can reproduce it even in PhpSpreadsheet:

require __DIR__ . '/vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\Calculation;

$objPHPExcel = new Spreadsheet();
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'kiki');
$name = html_entity_decode('cliché');
$objPHPExcel->addNamedRange(new NamedRange($name, $objPHPExcel->getActiveSheet(), 'A1'));
$res = Calculation::getInstance($objPHPExcel)->parseFormula('=' . $name);
var_dump($res);

@Dfred
Copy link
Author

Dfred commented Apr 28, 2017

Good job with PhpSpreadsheet by the way, any release date in sight?

@Dfred
Copy link
Author

Dfred commented May 19, 2017

@PowerKiKi Did you file a bug report on PhpSpreadsheet as well? If so, can you provide a link ?

@PowerKiKi
Copy link
Member

No, I didn't file an issue on PhpSpreadsheet. I wish we could move issue across projects...

A beta release is planned "soon"...

@Dfred
Copy link
Author

Dfred commented Jun 18, 2017

I copied this bug-report to PhpSpreadsheet, see it there: PHPOffice/PhpSpreadsheet#179

@PowerKiKi
Copy link
Member

Closing here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants