2016-08-31 16:15:54 +00:00
|
|
|
<?php
|
|
|
|
|
2017-05-17 22:02:17 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
|
|
|
2017-10-01 08:48:59 +00:00
|
|
|
require __DIR__ . '/../Header.php';
|
2016-08-31 16:15:54 +00:00
|
|
|
|
2017-10-01 08:48:59 +00:00
|
|
|
$spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
|
2016-08-31 16:15:54 +00:00
|
|
|
|
|
|
|
// Write temporary file
|
|
|
|
$filename = $helper->getTemporaryFilename('xls');
|
2017-05-17 22:02:17 +00:00
|
|
|
$writer = IOFactory::createWriter($spreadsheet, 'Xls');
|
2016-08-31 16:15:54 +00:00
|
|
|
$callStartTime = microtime(true);
|
|
|
|
$writer->save($filename);
|
|
|
|
$helper->logWrite($writer, $filename, $callStartTime);
|
|
|
|
|
2016-10-06 11:49:41 +00:00
|
|
|
// Read Xls file
|
2016-08-31 16:15:54 +00:00
|
|
|
$callStartTime = microtime(true);
|
2017-05-17 22:02:17 +00:00
|
|
|
$spreadsheet = IOFactory::load($filename);
|
2016-10-06 11:49:41 +00:00
|
|
|
$helper->logRead('Xls', $filename, $callStartTime);
|
2020-05-24 11:03:07 +00:00
|
|
|
unlink($filename);
|
2016-08-31 16:15:54 +00:00
|
|
|
|
|
|
|
// Save
|
|
|
|
$helper->write($spreadsheet, __FILE__);
|