Hi
Been looking at migrating existing PHPExcel Spreadsheet (blank) apps to PHPSpreadsheet.
I can’t even get the basics to work… create an empty spreadsheet as per the PHPSpreadsheet help page.
Elsewhere in the forum it says the way that SC implements the tool, the USE functions cant be used (They have to be at the start of a script I think), but the workaround seems confused (at least I couldn’t understand it
The HELP? item in the knowledge base is worse than useless… It has
- A link to an OLD version of PHPSpreadsheet
- A macro call (includesc_url_library) that as far as I know doesn’t exist
- All of the pictures are missing (presumably because of the dumb reorganisation of the forum a few months ago!)
I can get the lib to load, (I tried several different ways) but as soon as I try to use the first command:
$documento= new \PhpOffice\PhpSpreadsheet\Spreadsheet();
I get a syntax error within the Spreadsheet class. (I presume because the ‘use’ command in PHPSpreadsheet help, had to be deleted)
Code is:
require_once(’…/…/…/…’.$this->Ini->path_prod. ‘/third/phpspreadsheet/vendor/autoload.php’);
echo(“Hello
”);
//sc_include_library(“sys”,“PHPSpreadsheet”,“vendor/autoload.php”);//includesc_url_library(“sys”,“PHPSpreadsheet”,“vendor/autoload.php”);
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue(‘A1’, ‘Hello World !’);$writer = new Xlsx($spreadsheet);
$writer->save(‘hello world.xlsx’);
Error is:
Parse error: syntax error, unexpected ‘=’ in C:\Program Files\NetMake\v9Jun18\wwwroot\scriptcase\prod\third\phpspreadsheet\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Calculation\Calculation.php on line 2460
Can’t get much simpler than this… which begs the question why a similar simple example is not provided either in the knowledgebase or samples.