These are chat archives for PHPOffice/PhpSpreadsheet

26th
Dec 2017
Sherwin Gaddis
@juggernautsei
Dec 26 2017 01:15

I have loaded the library and gotten the sample code to work. The problem is I don't see or read anywhere how to turn off the screen output for the 46_ReadHtml.php

This is output that I need to turn off:

19:37:47 Read Html format from C:\oerm_dev\www\dev\mindfulemr3\vendor\phpoffice\phpspreadsheet\samples\Basic/../templates/46readHtml.html in 0.2000 seconds
19:37:47 Write Xlsx format to C:\Windows\TEMP/phpspreadsheet/46_ReadHtml.xlsx in 0.0550 seconds
19:37:47 Write Xls format to C:\Windows\TEMP/phpspreadsheet/46_ReadHtml.xls in 0.0390 seconds
19:37:47 Peak memory usage: 4MB

Could someone point me to the documentation of how to turn this off?

Adrien Crivelli
@PowerKiKi
Dec 26 2017 03:56
@juggernautsei the output you see are meant for the samples. They cannot be disabled. In production code, you should never use $helper.
Sherwin Gaddis
@juggernautsei
Dec 26 2017 12:31
@PowerKiKi How do I convert this to production code. Because without adding the helper the code did not work. I tried changing out the helper use PhpOffice\PhpSpreadsheet\Helper\Sample; for use PhpOffice\PhpSpreadsheet\Writer\Xlsx; $writer = new Xlsx(). This all failed to reproduce the output. Is there a production sample?
Adrien Crivelli
@PowerKiKi
Dec 26 2017 13:59
Sherwin Gaddis
@juggernautsei
Dec 26 2017 19:25

@PowerKiKi I was able to figure it out from there. I switched out the helper for

 //$helper->write($objPHPExcel, __FILE__);
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, 'Xlsx');
$writer->save('payroll.xlsx');

This works.