L
L
LoginSerj2017-04-05 13:30:52
PHP
LoginSerj, 2017-04-05 13:30:52

Why doesn't PHPExcel print the document?

I am using PHPExcel to fill in the template. As a result, it issues a document, everything fills in normally and opens. But when printing a document, Excel just throws an error and closes. For filling I use the following code:
require_once('PHPExcel.php');
require_once 'PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load('file/test.xlsx');
$objPHPExcel->setActiveSheetIndex(0);
$aSheet = $objPHPExcel->getActiveSheet();
$aSheet->setCellValue('B2', 'TEST');
require_once('PHPExcel/Writer/Excel2007.php');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setOffice2003Compatibility(true);
$objWriter->save('file/name.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LoginSerj, 2017-04-05
@LoginSerj

As always, I just wrote and found the solution myself... if anyone is interested, I removed the line:
$objWriter->setOffice2003Compatibility(true);
And it became normal to print

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question