0

I haven't access to my mySQL server, cannot install anything there with composer.

That's why I've downloaded PhpSpreadsheet files from here https://php-download.com/package/phpoffice/phpspreadsheet and packed to my local php directory.

But also the easy sample doesn't work. There just comes the error message

Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in [directory] on line 5

I want to switch from PhpExcel to PhpSpreadsheet. Unfortunately the usual installation of PhpSpreadsheet is with composer.

But ... why does the "use" not work in my code? Must be there the folders ..\Spreadsheet and ..\Xlsx present? They aren't. Where would I get them from ?

Thanks, Markus

require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • What has access to MySQL Server got to do with any of this – RiggsFolly Jan 17 '19 at 14:02
  • _Must be there the folders_ YES – RiggsFolly Jan 17 '19 at 14:07
  • You might like to read this [on the phpSpreadsheet help site](https://github.com/PHPOffice/PhpSpreadsheet/issues/417) basically you need to install composer to get it working properly as it has dependancies on other things outside the PHPSpreadsheet system itself – RiggsFolly Jan 17 '19 at 14:11
  • @RiggsFolly I need to use it witout composer. Unfortunately –  Jan 17 '19 at 14:15
  • Then from what the developers say, you may have a long voyage of discovery ahead of you, finding all these dependencies that is, which are all looked after for you by composer – RiggsFolly Jan 17 '19 at 14:19

0 Answers0