Introduce vendor prefix `PhpOffice` to namespace
This commit is contained in:
parent
2922a13764
commit
47cde0dadc
|
@ -45,12 +45,12 @@
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"PhpSpreadsheet\\": "src/PhpSpreadsheet"
|
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests"
|
"PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -44,7 +44,7 @@ $spreadsheet->setActiveSheetIndex(0);
|
||||||
$helper->log('Write to Excel2007 format');
|
$helper->log('Write to Excel2007 format');
|
||||||
|
|
||||||
// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file
|
// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file
|
||||||
PhpSpreadsheet\Settings::setZipClass(PhpSpreadsheet\Settings::PCLZIP);
|
\PhpOffice\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
$helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx']);
|
$helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx']);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require_once __DIR__ . '/../src/Bootstrap.php';
|
require_once __DIR__ . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$helper = new \PhpSpreadsheet\Helper\Sample();
|
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
|
||||||
if ($helper->isCli()) {
|
if ($helper->isCli()) {
|
||||||
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ if ($helper->isCli()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
||||||
|
@ -52,6 +52,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
|
||||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||||
header('Pragma: public'); // HTTP/1.0
|
header('Pragma: public'); // HTTP/1.0
|
||||||
|
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'OpenDocument');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'OpenDocument');
|
||||||
$writer->save('php://output');
|
$writer->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require_once __DIR__ . '/../src/Bootstrap.php';
|
require_once __DIR__ . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$helper = new \PhpSpreadsheet\Helper\Sample();
|
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
|
||||||
if ($helper->isCli()) {
|
if ($helper->isCli()) {
|
||||||
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
||||||
|
|
||||||
|
@ -11,16 +11,16 @@ if ($helper->isCli()) {
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||||
$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||||
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
$rendererLibrary = 'mPDF5.4';
|
$rendererLibrary = 'mPDF5.4';
|
||||||
//$rendererLibrary = 'domPDF0.6.0beta3';
|
//$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
$rendererLibraryPath = __DIR__ . '/../../../libraries/PDF/' . $rendererLibrary;
|
$rendererLibraryPath = __DIR__ . '/../../../libraries/PDF/' . $rendererLibrary;
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
||||||
|
@ -50,7 +50,7 @@ $spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||||
$spreadsheet->setActiveSheetIndex(0);
|
$spreadsheet->setActiveSheetIndex(0);
|
||||||
|
|
||||||
if (!PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -61,6 +61,6 @@ header('Content-Type: application/pdf');
|
||||||
header('Content-Disposition: attachment;filename="01simple.pdf"');
|
header('Content-Disposition: attachment;filename="01simple.pdf"');
|
||||||
header('Cache-Control: max-age=0');
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
|
||||||
$writer->save('php://output');
|
$writer->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require_once __DIR__ . '/../src/Bootstrap.php';
|
require_once __DIR__ . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$helper = new \PhpSpreadsheet\Helper\Sample();
|
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
|
||||||
if ($helper->isCli()) {
|
if ($helper->isCli()) {
|
||||||
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ if ($helper->isCli()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
||||||
|
@ -52,6 +52,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
|
||||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||||
header('Pragma: public'); // HTTP/1.0
|
header('Pragma: public'); // HTTP/1.0
|
||||||
|
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
||||||
$writer->save('php://output');
|
$writer->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
require_once __DIR__ . '/../src/Bootstrap.php';
|
require_once __DIR__ . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$helper = new \PhpSpreadsheet\Helper\Sample();
|
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
|
||||||
if ($helper->isCli()) {
|
if ($helper->isCli()) {
|
||||||
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
echo 'This example should only be run from a Web Browser' . PHP_EOL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
||||||
|
@ -51,6 +51,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
|
||||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||||
header('Pragma: public'); // HTTP/1.0
|
header('Pragma: public'); // HTTP/1.0
|
||||||
|
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->save('php://output');
|
$writer->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -70,41 +70,41 @@ $dateTimeNow = time();
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->setCellValue('A9', 'Date/Time')
|
->setCellValue('A9', 'Date/Time')
|
||||||
->setCellValue('B9', 'Date')
|
->setCellValue('B9', 'Date')
|
||||||
->setCellValue('C9', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
|
->setCellValue('C9', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getStyle('C9')
|
->getStyle('C9')
|
||||||
->getNumberFormat()
|
->getNumberFormat()
|
||||||
->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->setCellValue('A10', 'Date/Time')
|
->setCellValue('A10', 'Date/Time')
|
||||||
->setCellValue('B10', 'Time')
|
->setCellValue('B10', 'Time')
|
||||||
->setCellValue('C10', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
|
->setCellValue('C10', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getStyle('C10')
|
->getStyle('C10')
|
||||||
->getNumberFormat()
|
->getNumberFormat()
|
||||||
->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4);
|
->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->setCellValue('A11', 'Date/Time')
|
->setCellValue('A11', 'Date/Time')
|
||||||
->setCellValue('B11', 'Date and Time')
|
->setCellValue('B11', 'Date and Time')
|
||||||
->setCellValue('C11', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
|
->setCellValue('C11', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getStyle('C11')
|
->getStyle('C11')
|
||||||
->getNumberFormat()
|
->getNumberFormat()
|
||||||
->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
|
->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->setCellValue('A12', 'NULL')
|
->setCellValue('A12', 'NULL')
|
||||||
->setCellValue('C12', null);
|
->setCellValue('C12', null);
|
||||||
|
|
||||||
$richText = new \PhpSpreadsheet\RichText();
|
$richText = new \PhpOffice\PhpSpreadsheet\RichText();
|
||||||
$richText->createText('你好 ');
|
$richText->createText('你好 ');
|
||||||
|
|
||||||
$payable = $richText->createTextRun('你 好 吗?');
|
$payable = $richText->createTextRun('你 好 吗?');
|
||||||
$payable->getFont()->setBold(true);
|
$payable->getFont()->setBold(true);
|
||||||
$payable->getFont()->setItalic(true);
|
$payable->getFont()->setItalic(true);
|
||||||
$payable->getFont()->setColor(new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN));
|
$payable->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN));
|
||||||
|
|
||||||
$richText->createText(', unless specified otherwise on the invoice.');
|
$richText->createText(', unless specified otherwise on the invoice.');
|
||||||
|
|
||||||
|
@ -112,11 +112,11 @@ $spreadsheet->getActiveSheet()
|
||||||
->setCellValue('A13', 'Rich Text')
|
->setCellValue('A13', 'Rich Text')
|
||||||
->setCellValue('C13', $richText);
|
->setCellValue('C13', $richText);
|
||||||
|
|
||||||
$richText2 = new \PhpSpreadsheet\RichText();
|
$richText2 = new \PhpOffice\PhpSpreadsheet\RichText();
|
||||||
$richText2->createText("black text\n");
|
$richText2->createText("black text\n");
|
||||||
|
|
||||||
$red = $richText2->createTextRun('red text');
|
$red = $richText2->createTextRun('red text');
|
||||||
$red->getFont()->setColor(new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_RED));
|
$red->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED));
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getCell('C14')
|
->getCell('C14')
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -34,22 +34,22 @@ $spreadsheet->getActiveSheet()
|
||||||
|
|
||||||
// Add a drawing to the header
|
// Add a drawing to the header
|
||||||
$helper->log('Add a drawing to the header');
|
$helper->log('Add a drawing to the header');
|
||||||
$drawing = new \PhpSpreadsheet\Worksheet\HeaderFooterDrawing();
|
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing();
|
||||||
$drawing->setName('PhpSpreadsheet logo');
|
$drawing->setName('PhpSpreadsheet logo');
|
||||||
$drawing->setPath(__DIR__ . '/images/PhpSpreadsheet_logo.gif');
|
$drawing->setPath(__DIR__ . '/images/PhpSpreadsheet_logo.gif');
|
||||||
$drawing->setHeight(36);
|
$drawing->setHeight(36);
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getHeaderFooter()
|
->getHeaderFooter()
|
||||||
->addImage($drawing, \PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
|
->addImage($drawing, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
$helper->log('Set page orientation and size');
|
$helper->log('Set page orientation and size');
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getPageSetup()
|
->getPageSetup()
|
||||||
->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getPageSetup()
|
->getPageSetup()
|
||||||
->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename worksheet
|
// Rename worksheet
|
||||||
$helper->log('Rename worksheet');
|
$helper->log('Rename worksheet');
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$cacheMethod = \PhpSpreadsheet\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP;
|
$cacheMethod = \PhpOffice\PhpSpreadsheet\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP;
|
||||||
if (\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
|
if (\PhpOffice\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
|
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
|
||||||
} else {
|
} else {
|
||||||
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');
|
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$cacheMethod = \PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE;
|
$cacheMethod = \PhpOffice\PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE;
|
||||||
if (\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
|
if (\PhpOffice\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
|
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
|
||||||
} else {
|
} else {
|
||||||
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');
|
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$cacheMethod = \PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE3;
|
$cacheMethod = \PhpOffice\PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE3;
|
||||||
if (\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
|
if (\PhpOffice\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
|
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
|
||||||
} else {
|
} else {
|
||||||
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');
|
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');
|
||||||
|
|
|
@ -5,11 +5,11 @@ require __DIR__ . '/Header.php';
|
||||||
// Create temporary file that will be read
|
// Create temporary file that will be read
|
||||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
$filename = $helper->getTemporaryFilename();
|
$filename = $helper->getTemporaryFilename();
|
||||||
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -5,14 +5,14 @@ require __DIR__ . '/Header.php';
|
||||||
// Create temporary file that will be read
|
// Create temporary file that will be read
|
||||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
$filename = $helper->getTemporaryFilename();
|
$filename = $helper->getTemporaryFilename();
|
||||||
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
||||||
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
||||||
\PhpSpreadsheet\Settings::setZipClass(\PhpSpreadsheet\Settings::PCLZIP);
|
\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP);
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -47,30 +47,30 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12);
|
||||||
|
|
||||||
// Add conditional formatting
|
// Add conditional formatting
|
||||||
$helper->log('Add conditional formatting');
|
$helper->log('Add conditional formatting');
|
||||||
$conditional1 = new \PhpSpreadsheet\Style\Conditional();
|
$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
|
||||||
$conditional1->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_BETWEEN)
|
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_BETWEEN)
|
||||||
->addCondition('200')
|
->addCondition('200')
|
||||||
->addCondition('400');
|
->addCondition('400');
|
||||||
$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_YELLOW);
|
$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_YELLOW);
|
||||||
$conditional1->getStyle()->getFont()->setBold(true);
|
$conditional1->getStyle()->getFont()->setBold(true);
|
||||||
$conditional1->getStyle()->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$conditional1->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$conditional2 = new \PhpSpreadsheet\Style\Conditional();
|
$conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
|
||||||
$conditional2->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
$conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
|
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_RED);
|
$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
|
||||||
$conditional2->getStyle()->getFont()->setItalic(true);
|
$conditional2->getStyle()->getFont()->setItalic(true);
|
||||||
$conditional2->getStyle()->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$conditional2->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$conditional3 = new \PhpSpreadsheet\Style\Conditional();
|
$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
|
||||||
$conditional3->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
|
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_GREEN);
|
$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
|
||||||
$conditional3->getStyle()->getFont()->setItalic(true);
|
$conditional3->getStyle()->getFont()->setItalic(true);
|
||||||
$conditional3->getStyle()->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$conditional3->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles();
|
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles();
|
||||||
array_push($conditionalStyles, $conditional1);
|
array_push($conditionalStyles, $conditional1);
|
||||||
|
@ -98,8 +98,8 @@ $spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spread
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
$helper->log('Set page orientation and size');
|
$helper->log('Set page orientation and size');
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename worksheet
|
// Rename worksheet
|
||||||
$helper->log('Rename worksheet');
|
$helper->log('Rename worksheet');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -32,22 +32,22 @@ $spreadsheet->getActiveSheet()
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:A8')
|
$spreadsheet->getActiveSheet()->getStyle('A1:A8')
|
||||||
->getNumberFormat()
|
->getNumberFormat()
|
||||||
->setFormatCode(
|
->setFormatCode(
|
||||||
\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00
|
\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add conditional formatting
|
// Add conditional formatting
|
||||||
$helper->log('Add conditional formatting');
|
$helper->log('Add conditional formatting');
|
||||||
$conditional1 = new \PhpSpreadsheet\Style\Conditional();
|
$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
|
||||||
$conditional1->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
|
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_RED);
|
$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
|
||||||
|
|
||||||
$conditional3 = new \PhpSpreadsheet\Style\Conditional();
|
$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
|
||||||
$conditional3->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
|
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
|
||||||
->addCondition('1');
|
->addCondition('1');
|
||||||
$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_GREEN);
|
$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
|
||||||
|
|
||||||
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles();
|
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles();
|
||||||
array_push($conditionalStyles, $conditional1);
|
array_push($conditionalStyles, $conditional1);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -36,7 +36,7 @@ for ($i = 2; $i <= 50; ++$i) {
|
||||||
// Add page breaks every 10 rows
|
// Add page breaks every 10 rows
|
||||||
if ($i % 10 == 0) {
|
if ($i % 10 == 0) {
|
||||||
// Add a page break
|
// Add a page break
|
||||||
$spreadsheet->getActiveSheet()->setBreak('A' . $i, \PhpSpreadsheet\Worksheet::BREAK_ROW);
|
$spreadsheet->getActiveSheet()->setBreak('A' . $i, \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_ROW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -48,7 +48,7 @@ foreach ($years as $year) {
|
||||||
foreach ($countries as $country) {
|
foreach ($countries as $country) {
|
||||||
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
||||||
for ($i = 1; $i <= $endDays; ++$i) {
|
for ($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
$eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
|
@ -86,8 +86,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
|
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
||||||
$spreadsheet->getActiveSheet()->freezePane('A2');
|
$spreadsheet->getActiveSheet()->freezePane('A2');
|
||||||
|
|
||||||
|
@ -104,45 +104,45 @@ $helper->log('Set active filters');
|
||||||
// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
|
// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
|
||||||
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
|
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'u*'
|
'u*'
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'japan'
|
'japan'
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
// Filter the Date column on a filter value of the first day of every period of the current year
|
// Filter the Date column on a filter value of the first day of every period of the current year
|
||||||
// We us a dateGroup ruletype for this, although it is still a standard filter
|
// We us a dateGroup ruletype for this, although it is still a standard filter
|
||||||
foreach ($periods as $period) {
|
foreach ($periods as $period) {
|
||||||
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
|
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
|
||||||
|
|
||||||
$autoFilter->getColumn('D')
|
$autoFilter->getColumn('D')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
[
|
[
|
||||||
'year' => $currentYear,
|
'year' => $currentYear,
|
||||||
'month' => $period,
|
'month' => $period,
|
||||||
'day' => $endDate,
|
'day' => $endDate,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
||||||
}
|
}
|
||||||
// Display only sales values that are blank
|
// Display only sales values that are blank
|
||||||
// Standard filter, operator equals, and value of NULL
|
// Standard filter, operator equals, and value of NULL
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -48,7 +48,7 @@ foreach ($years as $year) {
|
||||||
foreach ($countries as $country) {
|
foreach ($countries as $country) {
|
||||||
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
||||||
for ($i = 1; $i <= $endDays; ++$i) {
|
for ($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
$eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
|
@ -86,8 +86,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
|
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
||||||
$spreadsheet->getActiveSheet()->freezePane('A2');
|
$spreadsheet->getActiveSheet()->freezePane('A2');
|
||||||
|
|
||||||
|
@ -104,39 +104,39 @@ $helper->log('Set active filters');
|
||||||
// Filter the Country column on a filter value of Germany
|
// Filter the Country column on a filter value of Germany
|
||||||
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
|
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'Germany'
|
'Germany'
|
||||||
);
|
);
|
||||||
// Filter the Date column on a filter value of the year to date
|
// Filter the Date column on a filter value of the year to date
|
||||||
$autoFilter->getColumn('D')
|
$autoFilter->getColumn('D')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
null,
|
null,
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
||||||
// Display only sales values that are between 400 and 600
|
// Display only sales values that are between 400 and 600
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
||||||
400
|
400
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setJoin(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
|
->setJoin(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
||||||
600
|
600
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
$helper->write($spreadsheet, __FILE__);
|
$helper->write($spreadsheet, __FILE__);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -48,7 +48,7 @@ foreach ($years as $year) {
|
||||||
foreach ($countries as $country) {
|
foreach ($countries as $country) {
|
||||||
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
|
||||||
for ($i = 1; $i <= $endDays; ++$i) {
|
for ($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
$eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
|
@ -86,8 +86,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
|
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
||||||
$spreadsheet->getActiveSheet()->freezePane('A2');
|
$spreadsheet->getActiveSheet()->freezePane('A2');
|
||||||
|
|
||||||
|
@ -104,45 +104,45 @@ $helper->log('Set active filters');
|
||||||
// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
|
// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
|
||||||
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
|
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'u*'
|
'u*'
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'japan'
|
'japan'
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
// Filter the Date column on a filter value of the first day of every period of the current year
|
// Filter the Date column on a filter value of the first day of every period of the current year
|
||||||
// We us a dateGroup ruletype for this, although it is still a standard filter
|
// We us a dateGroup ruletype for this, although it is still a standard filter
|
||||||
foreach ($periods as $period) {
|
foreach ($periods as $period) {
|
||||||
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
|
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
|
||||||
|
|
||||||
$autoFilter->getColumn('D')
|
$autoFilter->getColumn('D')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
[
|
[
|
||||||
'year' => $currentYear,
|
'year' => $currentYear,
|
||||||
'month' => $period,
|
'month' => $period,
|
||||||
'day' => $endDate,
|
'day' => $endDate,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
||||||
}
|
}
|
||||||
// Display only sales values that are blank
|
// Display only sales values that are blank
|
||||||
// Standard filter, operator equals, and value of NULL
|
// Standard filter, operator equals, and value of NULL
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -37,7 +37,7 @@ $spreadsheet->getActiveSheet()->getProtection()->setSheet(true);
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->getStyle('A2:B2')
|
->getStyle('A2:B2')
|
||||||
->getProtection()->setLocked(
|
->getProtection()->setLocked(
|
||||||
\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED
|
\PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED
|
||||||
);
|
);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -6,12 +6,12 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// List functions
|
// List functions
|
||||||
$helper->log('List implemented functions');
|
$helper->log('List implemented functions');
|
||||||
$calc = \PhpSpreadsheet\Calculation::getInstance();
|
$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
|
||||||
print_r($calc->listFunctionNames());
|
print_r($calc->listFunctionNames());
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Add some data, we will use some formulas here
|
// Add some data, we will use some formulas here
|
||||||
$helper->log('Add some data and formulas');
|
$helper->log('Add some data and formulas');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Add some data, we will use some formulas here
|
// Add some data, we will use some formulas here
|
||||||
$helper->log('Add some data and formulas');
|
$helper->log('Add some data and formulas');
|
||||||
|
@ -13,7 +13,7 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', '=B1')
|
||||||
->setCellValue('B1', '=A1+1')
|
->setCellValue('B1', '=A1+1')
|
||||||
->setCellValue('B2', '=A2');
|
->setCellValue('B2', '=A2');
|
||||||
|
|
||||||
\PhpSpreadsheet\Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
|
\PhpOffice\PhpSpreadsheet\Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
|
||||||
|
|
||||||
// Calculated data
|
// Calculated data
|
||||||
$helper->log('Calculated data');
|
$helper->log('Calculated data');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
|
|
||||||
$filename = $helper->getFilename(__FILE__, 'xls');
|
$filename = $helper->getFilename(__FILE__, 'xls');
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -35,8 +35,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Cell B3 and B5 contain data
|
||||||
// Set data validation
|
// Set data validation
|
||||||
$helper->log('Set data validation');
|
$helper->log('Set data validation');
|
||||||
$validation = $spreadsheet->getActiveSheet()->getCell('B3')->getDataValidation();
|
$validation = $spreadsheet->getActiveSheet()->getCell('B3')->getDataValidation();
|
||||||
$validation->setType(\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE);
|
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE);
|
||||||
$validation->setErrorStyle(\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
|
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
|
||||||
$validation->setAllowBlank(true);
|
$validation->setAllowBlank(true);
|
||||||
$validation->setShowInputMessage(true);
|
$validation->setShowInputMessage(true);
|
||||||
$validation->setShowErrorMessage(true);
|
$validation->setShowErrorMessage(true);
|
||||||
|
@ -48,8 +48,8 @@ $validation->setFormula1(10);
|
||||||
$validation->setFormula2(20);
|
$validation->setFormula2(20);
|
||||||
|
|
||||||
$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation();
|
$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation();
|
||||||
$validation->setType(\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
|
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
|
||||||
$validation->setErrorStyle(\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
|
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
|
||||||
$validation->setAllowBlank(false);
|
$validation->setAllowBlank(false);
|
||||||
$validation->setShowInputMessage(true);
|
$validation->setShowInputMessage(true);
|
||||||
$validation->setShowErrorMessage(true);
|
$validation->setShowErrorMessage(true);
|
||||||
|
@ -61,8 +61,8 @@ $validation->setPrompt('Please pick a value from the drop-down list.');
|
||||||
$validation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!!
|
$validation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!!
|
||||||
|
|
||||||
$validation = $spreadsheet->getActiveSheet()->getCell('B7')->getDataValidation();
|
$validation = $spreadsheet->getActiveSheet()->getCell('B7')->getDataValidation();
|
||||||
$validation->setType(\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
|
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
|
||||||
$validation->setErrorStyle(\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
|
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
|
||||||
$validation->setAllowBlank(false);
|
$validation->setAllowBlank(false);
|
||||||
$validation->setShowInputMessage(true);
|
$validation->setShowInputMessage(true);
|
||||||
$validation->setShowErrorMessage(true);
|
$validation->setShowErrorMessage(true);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
|
|
||||||
$helper->log('Write to CSV format');
|
$helper->log('Write to CSV format');
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV')->setDelimiter(',')
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV')->setDelimiter(',')
|
||||||
->setEnclosure('"')
|
->setEnclosure('"')
|
||||||
->setSheetIndex(0);
|
->setSheetIndex(0);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ $helper->logWrite($writer, $filename, $callStartTime);
|
||||||
|
|
||||||
$helper->log('Read from CSV format');
|
$helper->log('Read from CSV format');
|
||||||
|
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('CSV')->setDelimiter(',')
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('CSV')->setDelimiter(',')
|
||||||
->setEnclosure('"')
|
->setEnclosure('"')
|
||||||
->setSheetIndex(0);
|
->setSheetIndex(0);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ $helper->write($spreadsheetFromCSV, __FILE__, ['Excel2007' => 'xlsx']);
|
||||||
|
|
||||||
// Write CSV
|
// Write CSV
|
||||||
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
|
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
|
||||||
$writerCSV = \PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'CSV');
|
$writerCSV = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'CSV');
|
||||||
$writerCSV->setExcelCompatibility(true);
|
$writerCSV->setExcelCompatibility(true);
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
|
|
||||||
$filename = $helper->getFilename(__FILE__, 'html');
|
$filename = $helper->getFilename(__FILE__, 'html');
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// List functions
|
// List functions
|
||||||
$helper->log('List implemented functions');
|
$helper->log('List implemented functions');
|
||||||
$calc = \PhpSpreadsheet\Calculation::getInstance();
|
$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
|
||||||
print_r($calc->listFunctionNames());
|
print_r($calc->listFunctionNames());
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Add some data, we will use some formulas here
|
// Add some data, we will use some formulas here
|
||||||
$helper->log('Add some data');
|
$helper->log('Add some data');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -28,8 +28,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:')
|
||||||
|
|
||||||
// Define named ranges
|
// Define named ranges
|
||||||
$helper->log('Define named ranges');
|
$helper->log('Define named ranges');
|
||||||
$spreadsheet->addNamedRange(new \PhpSpreadsheet\NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
|
$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
|
||||||
$spreadsheet->addNamedRange(new \PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
|
$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
|
||||||
|
|
||||||
// Rename named ranges
|
// Rename named ranges
|
||||||
$helper->log('Rename named ranges');
|
$helper->log('Rename named ranges');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$filename = __DIR__ . '/templates/Excel2003XMLTest.xml';
|
$filename = __DIR__ . '/templates/Excel2003XMLTest.xml';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('Excel2003XML', $filename, $callStartTime);
|
$helper->logRead('Excel2003XML', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -6,14 +6,14 @@ $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
|
|
||||||
// Write temporary file
|
// Write temporary file
|
||||||
$filename = $helper->getTemporaryFilename('xls');
|
$filename = $helper->getTemporaryFilename('xls');
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
$helper->logWrite($writer, $filename, $callStartTime);
|
$helper->logWrite($writer, $filename, $callStartTime);
|
||||||
|
|
||||||
// Read Excel5 file
|
// Read Excel5 file
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('Excel5', $filename, $callStartTime);
|
$helper->logRead('Excel5', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$filename = __DIR__ . '/templates/GnumericTest.gnumeric';
|
$filename = __DIR__ . '/templates/GnumericTest.gnumeric';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('Gnumeric', $filename, $callStartTime);
|
$helper->logRead('Gnumeric', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$filename = __DIR__ . '/templates/OOCalcTest.ods';
|
$filename = __DIR__ . '/templates/OOCalcTest.ods';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('OOCalc', $filename, $callStartTime);
|
$helper->logRead('OOCalc', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
||||||
PhpSpreadsheet\Settings::setZipClass(PhpSpreadsheet\Settings::PCLZIP);
|
\PhpOffice\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP);
|
||||||
|
|
||||||
$filename = __DIR__ . '/templates/OOCalcTest.ods';
|
$filename = __DIR__ . '/templates/OOCalcTest.ods';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('OOCalc', $filename, $callStartTime);
|
$helper->logRead('OOCalc', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$filename = __DIR__ . '/templates/SylkTest.slk';
|
$filename = __DIR__ . '/templates/SylkTest.slk';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
$helper->logRead('SYLK', $filename, $callStartTime);
|
$helper->logRead('SYLK', $filename, $callStartTime);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -5,9 +5,9 @@ $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||||
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||||
$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
//$rendererLibrary = 'mPDF5.4';
|
//$rendererLibrary = 'mPDF5.4';
|
||||||
$rendererLibrary = 'domPDF0.6.0beta3';
|
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
|
@ -17,11 +17,11 @@ $helper->log('Hide grid lines');
|
||||||
$spreadsheet->getActiveSheet()->setShowGridLines(false);
|
$spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||||
|
|
||||||
$helper->log('Set orientation to landscape');
|
$helper->log('Set orientation to landscape');
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
|
|
||||||
$helper->log("Write to PDF format using {$rendererName}");
|
$helper->log("Write to PDF format using {$rendererName}");
|
||||||
|
|
||||||
if (!\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -22,19 +22,19 @@ $spreadsheet->setActiveSheetIndex(0);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
|
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
|
||||||
['fill' => [
|
['fill' => [
|
||||||
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
||||||
'color' => ['argb' => 'FFCCFFCC'],
|
'color' => ['argb' => 'FFCCFFCC'],
|
||||||
],
|
],
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'bottom' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_THIN],
|
'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
|
||||||
'right' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
|
'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
|
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
|
||||||
['fill' => [
|
['fill' => [
|
||||||
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
||||||
'color' => ['argb' => 'FFFFFF00'],
|
'color' => ['argb' => 'FFFFFF00'],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -20,29 +20,29 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
||||||
$helper->log('Add some data');
|
$helper->log('Add some data');
|
||||||
$spreadsheet->setActiveSheetIndex(0);
|
$spreadsheet->setActiveSheetIndex(0);
|
||||||
|
|
||||||
$sharedStyle1 = new \PhpSpreadsheet\Style();
|
$sharedStyle1 = new \PhpOffice\PhpSpreadsheet\Style();
|
||||||
$sharedStyle2 = new \PhpSpreadsheet\Style();
|
$sharedStyle2 = new \PhpOffice\PhpSpreadsheet\Style();
|
||||||
|
|
||||||
$sharedStyle1->applyFromArray(
|
$sharedStyle1->applyFromArray(
|
||||||
['fill' => [
|
['fill' => [
|
||||||
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
||||||
'color' => ['argb' => 'FFCCFFCC'],
|
'color' => ['argb' => 'FFCCFFCC'],
|
||||||
],
|
],
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'bottom' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_THIN],
|
'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
|
||||||
'right' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
|
'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$sharedStyle2->applyFromArray(
|
$sharedStyle2->applyFromArray(
|
||||||
['fill' => [
|
['fill' => [
|
||||||
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
||||||
'color' => ['argb' => 'FFFFFF00'],
|
'color' => ['argb' => 'FFFFFF00'],
|
||||||
],
|
],
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'bottom' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_THIN],
|
'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
|
||||||
'right' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
|
'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet;
|
namespace PhpOffice\PhpSpreadsheet;
|
||||||
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Write temporary file
|
// Write temporary file
|
||||||
$largeSpreadsheet = require __DIR__ . '/templates/largeSpreadsheet.php';
|
$largeSpreadsheet = require __DIR__ . '/templates/largeSpreadsheet.php';
|
||||||
$writer = new \PhpSpreadsheet\Writer\Excel2007($largeSpreadsheet);
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($largeSpreadsheet);
|
||||||
$filename = $helper->getTemporaryFilename();
|
$filename = $helper->getTemporaryFilename();
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
$helper->logWrite($writer, $filename, $callStartTime);
|
$helper->logWrite($writer, $filename, $callStartTime);
|
||||||
|
|
||||||
class MyReadFilter implements \PhpSpreadsheet\Reader\IReadFilter
|
class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
||||||
{
|
{
|
||||||
public function readCell($column, $row, $worksheetName = '')
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ class MyReadFilter implements \PhpSpreadsheet\Reader\IReadFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
$helper->log('Load from Excel2007 file');
|
$helper->log('Load from Excel2007 file');
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||||
$reader->setReadFilter(new MyReadFilter());
|
$reader->setReadFilter(new MyReadFilter());
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = $reader->load($filename);
|
$spreadsheet = $reader->load($filename);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -24,12 +24,12 @@ imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor);
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
$helper->log('Add a drawing to the worksheet');
|
$helper->log('Add a drawing to the worksheet');
|
||||||
$drawing = new \PhpSpreadsheet\Worksheet\MemoryDrawing();
|
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing();
|
||||||
$drawing->setName('Sample image');
|
$drawing->setName('Sample image');
|
||||||
$drawing->setDescription('Sample image');
|
$drawing->setDescription('Sample image');
|
||||||
$drawing->setImageResource($gdImage);
|
$drawing->setImageResource($gdImage);
|
||||||
$drawing->setRenderingFunction(\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG);
|
$drawing->setRenderingFunction(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG);
|
||||||
$drawing->setMimeType(\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
|
$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
|
||||||
$drawing->setHeight(36);
|
$drawing->setHeight(36);
|
||||||
$drawing->setWorksheet($spreadsheet->getActiveSheet());
|
$drawing->setWorksheet($spreadsheet->getActiveSheet());
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Change these values to select the PDF Rendering library that you wish to use
|
// Change these values to select the PDF Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||||
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||||
$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
//$rendererLibrary = 'mPDF5.4';
|
//$rendererLibrary = 'mPDF5.4';
|
||||||
$rendererLibrary = 'domPDF0.6.0beta3';
|
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
|
@ -14,7 +14,7 @@ $rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||||
|
|
||||||
// Read from Excel2007 (.xlsx) template
|
// Read from Excel2007 (.xlsx) template
|
||||||
$helper->log('Load Excel2007 template file');
|
$helper->log('Load Excel2007 template file');
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||||
$spreadsheet = $reader->load(__DIR__ . '/templates/26template.xlsx');
|
$spreadsheet = $reader->load(__DIR__ . '/templates/26template.xlsx');
|
||||||
|
|
||||||
/* at this point, we could do some manipulations with the template, but we skip this step */
|
/* at this point, we could do some manipulations with the template, but we skip this step */
|
||||||
|
@ -23,7 +23,7 @@ $helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx', 'Excel5' => 'xls'
|
||||||
// Export to PDF (.pdf)
|
// Export to PDF (.pdf)
|
||||||
$helper->log('Write to PDF format');
|
$helper->log('Write to PDF format');
|
||||||
try {
|
try {
|
||||||
if (!\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
} else {
|
} else {
|
||||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
||||||
|
@ -39,7 +39,7 @@ $worksheet->removeRow(1, 2);
|
||||||
|
|
||||||
// Export to CSV (.csv)
|
// Export to CSV (.csv)
|
||||||
$helper->log('Write to CSV format');
|
$helper->log('Write to CSV format');
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV');
|
||||||
$filename = $helper->getFilename(__FILE__, 'csv');
|
$filename = $helper->getFilename(__FILE__, 'csv');
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Read from Excel5 (.xls) template
|
// Read from Excel5 (.xls) template
|
||||||
$helper->log('Load Excel2007 template file');
|
$helper->log('Load Excel2007 template file');
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel5');
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5');
|
||||||
$spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls');
|
$spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls');
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
|
|
|
@ -4,13 +4,13 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
$filename = $helper->getTemporaryFilename();
|
$filename = $helper->getTemporaryFilename();
|
||||||
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
$helper->logWrite($writer, $filename, $callStartTime);
|
$helper->logWrite($writer, $filename, $callStartTime);
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||||
$spreadsheet = $reader->load($filename);
|
$spreadsheet = $reader->load($filename);
|
||||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||||
$helper->log('Iterate worksheets');
|
$helper->log('Iterate worksheets');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Set timezone
|
// Set timezone
|
||||||
|
@ -9,11 +9,11 @@ date_default_timezone_set('UTC');
|
||||||
|
|
||||||
// Set value binder
|
// Set value binder
|
||||||
$helper->log('Set value binder');
|
$helper->log('Set value binder');
|
||||||
\PhpSpreadsheet\Cell::setValueBinder(new \PhpSpreadsheet\Cell\AdvancedValueBinder());
|
\PhpOffice\PhpSpreadsheet\Cell::setValueBinder(new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder());
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$helper->log('Load from Excel5 template');
|
$helper->log('Load from Excel5 template');
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel5');
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5');
|
||||||
$spreadsheet = $reader->load(__DIR__ . '/templates/30template.xls');
|
$spreadsheet = $reader->load(__DIR__ . '/templates/30template.xls');
|
||||||
|
|
||||||
$helper->log('Add new data to the template');
|
$helper->log('Add new data to the template');
|
||||||
|
@ -21,7 +21,7 @@ $data = [['title' => 'Excel for dummies',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('D1', \PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
|
$spreadsheet->getActiveSheet()->setCellValue('D1', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
|
||||||
|
|
||||||
$baseRow = 5;
|
$baseRow = 5;
|
||||||
foreach ($data as $r => $dataRow) {
|
foreach ($data as $r => $dataRow) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ require __DIR__ . '/Header.php';
|
||||||
$inputFileType = 'Excel2007';
|
$inputFileType = 'Excel2007';
|
||||||
$inputFileName = __DIR__ . '/templates/31docproperties.xlsx';
|
$inputFileName = __DIR__ . '/templates/31docproperties.xlsx';
|
||||||
|
|
||||||
$spreadsheetReader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$spreadsheetReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = $spreadsheetReader->load($inputFileName);
|
$spreadsheet = $spreadsheetReader->load($inputFileName);
|
||||||
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
|
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
|
||||||
|
@ -18,7 +18,7 @@ $spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document')
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
$helper->logWrite($writer, $filename, $callStartTime);
|
$helper->logWrite($writer, $filename, $callStartTime);
|
||||||
|
@ -28,7 +28,7 @@ $helper->logEndingNotes();
|
||||||
|
|
||||||
// Reread File
|
// Reread File
|
||||||
$helper->log('Reread Excel2007 file');
|
$helper->log('Reread Excel2007 file');
|
||||||
$spreadsheetRead = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
|
|
||||||
// Set properties
|
// Set properties
|
||||||
$helper->log('Get properties');
|
$helper->log('Get properties');
|
||||||
|
@ -53,9 +53,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
|
||||||
foreach ($customProperties as $customProperty) {
|
foreach ($customProperties as $customProperty) {
|
||||||
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
|
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
|
||||||
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
|
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
|
||||||
if ($propertyType == \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
|
if ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
|
||||||
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
|
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
|
||||||
} elseif ($propertyType == \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
|
} elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
|
||||||
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
|
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
|
||||||
} else {
|
} else {
|
||||||
$formattedValue = $propertyValue;
|
$formattedValue = $propertyValue;
|
||||||
|
|
|
@ -5,7 +5,7 @@ require __DIR__ . '/Header.php';
|
||||||
$inputFileType = 'Excel5';
|
$inputFileType = 'Excel5';
|
||||||
$inputFileName = __DIR__ . '/templates/31docproperties.xls';
|
$inputFileName = __DIR__ . '/templates/31docproperties.xls';
|
||||||
|
|
||||||
$spreadsheetReader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$spreadsheetReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = $spreadsheetReader->load($inputFileName);
|
$spreadsheet = $spreadsheetReader->load($inputFileName);
|
||||||
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
|
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
|
||||||
|
@ -18,7 +18,7 @@ $spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document')
|
||||||
|
|
||||||
// Save Excel 95 file
|
// Save Excel 95 file
|
||||||
$filename = $helper->getFilename(__FILE__, 'xls');
|
$filename = $helper->getFilename(__FILE__, 'xls');
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
$helper->logWrite($writer, $filename, $callStartTime);
|
$helper->logWrite($writer, $filename, $callStartTime);
|
||||||
|
@ -28,7 +28,7 @@ $helper->logEndingNotes();
|
||||||
|
|
||||||
// Reread File
|
// Reread File
|
||||||
$helper->log('Reread Excel5 file');
|
$helper->log('Reread Excel5 file');
|
||||||
$spreadsheetRead = \PhpSpreadsheet\IOFactory::load($filename);
|
$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||||
|
|
||||||
// Set properties
|
// Set properties
|
||||||
$helper->log('Get properties');
|
$helper->log('Get properties');
|
||||||
|
@ -53,9 +53,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
|
||||||
foreach ($customProperties as $customProperty) {
|
foreach ($customProperties as $customProperty) {
|
||||||
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
|
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
|
||||||
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
|
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
|
||||||
if ($propertyType == \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
|
if ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
|
||||||
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
|
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
|
||||||
} elseif ($propertyType == \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
|
} elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
|
||||||
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
|
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
|
||||||
} else {
|
} else {
|
||||||
$formattedValue = $propertyValue;
|
$formattedValue = $propertyValue;
|
||||||
|
|
|
@ -20,7 +20,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
$helper->log('File ' . $inputFileNameShort . ' does not exist');
|
$helper->log('File ' . $inputFileNameShort . ' does not exist');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$reader->setIncludeCharts(true);
|
$reader->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet = $reader->load($inputFileName);
|
$spreadsheet = $reader->load($inputFileName);
|
||||||
|
@ -69,7 +69,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$outputFileName = $helper->getFilename($inputFileName);
|
$outputFileName = $helper->getFilename($inputFileName);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($outputFileName);
|
$writer->save($outputFileName);
|
||||||
|
|
|
@ -4,11 +4,11 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
$rendererName = PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH;
|
||||||
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
||||||
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
||||||
|
|
||||||
if (!PhpSpreadsheet\Settings::setChartRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -35,7 +35,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
|
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
|
||||||
|
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$reader->setIncludeCharts(true);
|
$reader->setIncludeCharts(true);
|
||||||
$spreadsheet = $reader->load($inputFileName);
|
$spreadsheet = $reader->load($inputFileName);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
$filename = $helper->getFilename($inputFileName);
|
$filename = $helper->getFilename($inputFileName);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -4,15 +4,15 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// for PDF files, and its directory location on your server
|
// for PDF files, and its directory location on your server
|
||||||
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||||
$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||||
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
$rendererLibrary = 'mPDF5.4';
|
$rendererLibrary = 'mPDF5.4';
|
||||||
//$rendererLibrary = 'domPDF0.6.0beta3';
|
//$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||||
|
|
||||||
if (!PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -20,11 +20,11 @@ if (!PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// for Chart images, and its directory location on your server
|
// for Chart images, and its directory location on your server
|
||||||
$rendererName = PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH;
|
||||||
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
||||||
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
||||||
|
|
||||||
if (!PhpSpreadsheet\Settings::setChartRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -51,7 +51,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
|
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
|
||||||
|
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$reader->setIncludeCharts(true);
|
$reader->setIncludeCharts(true);
|
||||||
$spreadsheet = $reader->load($inputFileName);
|
$spreadsheet = $reader->load($inputFileName);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
$filename = $helper->getFilename($inputFileName);
|
$filename = $helper->getFilename($inputFileName);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,9 +23,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -35,7 +35,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -45,15 +45,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -61,15 +61,15 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -89,7 +89,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
|
$spreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,9 +23,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -35,7 +35,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -45,15 +45,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -61,18 +61,18 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a horizontal bar rather than a vertical column graph
|
// Make it a horizontal bar rather than a vertical column graph
|
||||||
$series->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_BAR);
|
$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_BAR);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Chart');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -92,7 +92,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,9 +23,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -35,7 +35,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -45,15 +45,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -61,18 +61,18 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Column Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -92,7 +92,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -31,9 +31,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 'Budget'
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 'Budget'
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 'Forecast'
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 'Forecast'
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), // 'Actual'
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), // 'Actual'
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -43,7 +43,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -53,15 +53,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', null, 12),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -69,19 +69,19 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_BOTTOM, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_BOTTOM, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Grouped Column Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Grouped Column Chart');
|
||||||
$xAxisLabel = new \PhpSpreadsheet\Chart\Title('Financial Period');
|
$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Financial Period');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -101,7 +101,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -31,13 +31,13 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels1 = [
|
$dataSeriesLabels1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // Temperature
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // Temperature
|
||||||
];
|
];
|
||||||
$dataSeriesLabels2 = [
|
$dataSeriesLabels2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
|
||||||
];
|
];
|
||||||
$dataSeriesLabels3 = [
|
$dataSeriesLabels3 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // Humidity
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // Humidity
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
|
@ -48,7 +48,7 @@ $dataSeriesLabels3 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
|
@ -59,13 +59,13 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues1 = [
|
$dataSeriesValues1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', null, 12),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series1 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues1) - 1), // plotOrder
|
range(0, count($dataSeriesValues1) - 1), // plotOrder
|
||||||
$dataSeriesLabels1, // plotLabel
|
$dataSeriesLabels1, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -73,7 +73,7 @@ $series1 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series1->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
$series1->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -83,13 +83,13 @@ $series1->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues2 = [
|
$dataSeriesValues2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series2 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
||||||
$dataSeriesLabels2, // plotLabel
|
$dataSeriesLabels2, // plotLabel
|
||||||
null, // plotCategory
|
null, // plotCategory
|
||||||
|
@ -104,13 +104,13 @@ $series2 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues3 = [
|
$dataSeriesValues3 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series3 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series3 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
||||||
$dataSeriesLabels3, // plotLabel
|
$dataSeriesLabels3, // plotLabel
|
||||||
null, // plotCategory
|
null, // plotCategory
|
||||||
|
@ -118,14 +118,14 @@ $series3 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series1, $series2, $series3]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series1, $series2, $series3]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Average Weather Chart for Crete');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Average Weather Chart for Crete');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -145,7 +145,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,9 +23,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -35,7 +35,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -45,15 +45,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -61,15 +61,15 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Stacked Line Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stacked Line Chart');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -89,7 +89,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,9 +23,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels1 = [
|
$dataSeriesLabels1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -35,7 +35,7 @@ $dataSeriesLabels1 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues1 = [
|
$xAxisTickValues1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -45,15 +45,15 @@ $xAxisTickValues1 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues1 = [
|
$dataSeriesValues1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series1 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues1) - 1), // plotOrder
|
range(0, count($dataSeriesValues1) - 1), // plotOrder
|
||||||
$dataSeriesLabels1, // plotLabel
|
$dataSeriesLabels1, // plotLabel
|
||||||
$xAxisTickValues1, // plotCategory
|
$xAxisTickValues1, // plotCategory
|
||||||
|
@ -61,15 +61,15 @@ $series1 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea1 = new \PhpSpreadsheet\Chart\PlotArea(null, [$series1]);
|
$plotArea1 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series1]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend1 = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
$legend1 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
||||||
|
|
||||||
$title1 = new \PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
|
$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
|
||||||
$yAxisLabel1 = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart1 = new \PhpSpreadsheet\Chart(
|
$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title1, // title
|
$title1, // title
|
||||||
$legend1, // legend
|
$legend1, // legend
|
||||||
|
@ -95,9 +95,9 @@ $worksheet->addChart($chart1);
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels2 = [
|
$dataSeriesLabels2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -107,7 +107,7 @@ $dataSeriesLabels2 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues2 = [
|
$xAxisTickValues2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -117,15 +117,15 @@ $xAxisTickValues2 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues2 = [
|
$dataSeriesValues2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series2 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
||||||
$dataSeriesLabels2, // plotLabel
|
$dataSeriesLabels2, // plotLabel
|
||||||
$xAxisTickValues2, // plotCategory
|
$xAxisTickValues2, // plotCategory
|
||||||
|
@ -133,18 +133,18 @@ $series2 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series2->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
$series2->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea2 = new \PhpSpreadsheet\Chart\PlotArea(null, [$series2]);
|
$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series2]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend2 = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend2 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title2 = new \PhpSpreadsheet\Chart\Title('Test Column Chart');
|
$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
|
||||||
$yAxisLabel2 = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart2 = new \PhpSpreadsheet\Chart(
|
$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart2', // name
|
'chart2', // name
|
||||||
$title2, // title
|
$title2, // title
|
||||||
$legend2, // legend
|
$legend2, // legend
|
||||||
|
@ -164,7 +164,7 @@ $worksheet->addChart($chart2);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,7 +23,7 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels1 = [
|
$dataSeriesLabels1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -33,7 +33,7 @@ $dataSeriesLabels1 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues1 = [
|
$xAxisTickValues1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -43,12 +43,12 @@ $xAxisTickValues1 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues1 = [
|
$dataSeriesValues1 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series1 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
|
||||||
null, // plotGrouping (Pie charts don't have any grouping)
|
null, // plotGrouping (Pie charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues1) - 1), // plotOrder
|
range(0, count($dataSeriesValues1) - 1), // plotOrder
|
||||||
$dataSeriesLabels1, // plotLabel
|
$dataSeriesLabels1, // plotLabel
|
||||||
|
@ -57,19 +57,19 @@ $series1 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up a layout object for the Pie chart
|
// Set up a layout object for the Pie chart
|
||||||
$layout1 = new \PhpSpreadsheet\Chart\Layout();
|
$layout1 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
|
||||||
$layout1->setShowVal(true);
|
$layout1->setShowVal(true);
|
||||||
$layout1->setShowPercent(true);
|
$layout1->setShowPercent(true);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea1 = new \PhpSpreadsheet\Chart\PlotArea($layout1, [$series1]);
|
$plotArea1 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout1, [$series1]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend1 = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend1 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title1 = new \PhpSpreadsheet\Chart\Title('Test Pie Chart');
|
$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Pie Chart');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart1 = new \PhpSpreadsheet\Chart(
|
$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title1, // title
|
$title1, // title
|
||||||
$legend1, // legend
|
$legend1, // legend
|
||||||
|
@ -95,7 +95,7 @@ $worksheet->addChart($chart1);
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels2 = [
|
$dataSeriesLabels2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -105,7 +105,7 @@ $dataSeriesLabels2 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues2 = [
|
$xAxisTickValues2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -115,12 +115,12 @@ $xAxisTickValues2 = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues2 = [
|
$dataSeriesValues2 = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series2 = new \PhpSpreadsheet\Chart\DataSeries(
|
$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_DONUTCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_DONUTCHART, // plotType
|
||||||
null, // plotGrouping (Donut charts don't have any grouping)
|
null, // plotGrouping (Donut charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
range(0, count($dataSeriesValues2) - 1), // plotOrder
|
||||||
$dataSeriesLabels2, // plotLabel
|
$dataSeriesLabels2, // plotLabel
|
||||||
|
@ -129,17 +129,17 @@ $series2 = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up a layout object for the Pie chart
|
// Set up a layout object for the Pie chart
|
||||||
$layout2 = new \PhpSpreadsheet\Chart\Layout();
|
$layout2 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
|
||||||
$layout2->setShowVal(true);
|
$layout2->setShowVal(true);
|
||||||
$layout2->setShowCatName(true);
|
$layout2->setShowCatName(true);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea2 = new \PhpSpreadsheet\Chart\PlotArea($layout2, [$series2]);
|
$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout2, [$series2]);
|
||||||
|
|
||||||
$title2 = new \PhpSpreadsheet\Chart\Title('Test Donut Chart');
|
$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Donut Chart');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart2 = new \PhpSpreadsheet\Chart(
|
$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart2', // name
|
'chart2', // name
|
||||||
$title2, // title
|
$title2, // title
|
||||||
null, // legend
|
null, // legend
|
||||||
|
@ -159,7 +159,7 @@ $worksheet->addChart($chart2);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -31,8 +31,8 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -42,8 +42,8 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -53,13 +53,13 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_RADARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_RADARCHART, // plotType
|
||||||
null, // plotGrouping (Radar charts don't have any grouping)
|
null, // plotGrouping (Radar charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
|
@ -67,21 +67,21 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
$dataSeriesValues, // plotValues
|
$dataSeriesValues, // plotValues
|
||||||
null, // plotDirection
|
null, // plotDirection
|
||||||
null, // smooth line
|
null, // smooth line
|
||||||
\PhpSpreadsheet\Chart\DataSeries::STYLE_MARKER // plotStyle
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_MARKER // plotStyle
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up a layout object for the Pie chart
|
// Set up a layout object for the Pie chart
|
||||||
$layout = new \PhpSpreadsheet\Chart\Layout();
|
$layout = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea($layout, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Radar Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Radar Chart');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -101,7 +101,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -23,13 +23,13 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -39,14 +39,14 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
|
||||||
null, // plotGrouping (Scatter charts don't have any grouping)
|
null, // plotGrouping (Scatter charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
|
@ -54,19 +54,19 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
$dataSeriesValues, // plotValues
|
$dataSeriesValues, // plotValues
|
||||||
null, // plotDirection
|
null, // plotDirection
|
||||||
null, // smooth line
|
null, // smooth line
|
||||||
\PhpSpreadsheet\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Scatter Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Scatter Chart');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -86,7 +86,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -18,7 +18,7 @@ $worksheet->fromArray(
|
||||||
'A1',
|
'A1',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_00);
|
$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_00);
|
||||||
|
|
||||||
// Set the Labels for each data series we want to plot
|
// Set the Labels for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -28,10 +28,10 @@ $worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PhpSpreadsheet\S
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), //Max / Open
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), //Max / Open
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), //Min / Close
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), //Min / Close
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), //Min Threshold / Min
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), //Min Threshold / Min
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), //Max Threshold / Max
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), //Max Threshold / Max
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -41,7 +41,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$6', null, 5), // Counts
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$6', null, 5), // Counts
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -51,15 +51,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', null, 5),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', null, 5),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', null, 5),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', null, 5),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', null, 5),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', null, 5),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', null, 5),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', null, 5),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_STOCKCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_STOCKCHART, // plotType
|
||||||
null, // plotGrouping - if we set this to not null, then xlsx throws error
|
null, // plotGrouping - if we set this to not null, then xlsx throws error
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
|
@ -68,16 +68,16 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Stock Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stock Chart');
|
||||||
$xAxisLabel = new \PhpSpreadsheet\Chart\Title('Counts');
|
$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Counts');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Values');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Values');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'stock-chart', // name
|
'stock-chart', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -97,7 +97,7 @@ $worksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** PhpSpreadsheet */
|
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create temporary file that will be read
|
// Create temporary file that will be read
|
||||||
$sampleSpreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
|
$sampleSpreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
|
||||||
$filename = $helper->getTemporaryFilename();
|
$filename = $helper->getTemporaryFilename();
|
||||||
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
||||||
$helper->log('Load from Excel2007 file');
|
$helper->log('Load from Excel2007 file');
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||||
$reader->setIncludeCharts(true);
|
$reader->setIncludeCharts(true);
|
||||||
$spreadsheet = $reader->load($filename);
|
$spreadsheet = $reader->load($filename);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ $worksheet->fromArray(
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
$filename = $helper->getFilename(__FILE__);
|
$filename = $helper->getFilename(__FILE__);
|
||||||
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||||
$writer->setIncludeCharts(true);
|
$writer->setIncludeCharts(true);
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
|
@ -4,11 +4,11 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
$rendererName = PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH;
|
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH;
|
||||||
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
||||||
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
||||||
|
|
||||||
if (!PhpSpreadsheet\Settings::setChartRenderer($rendererName, $rendererLibraryPath)) {
|
if (!\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer($rendererName, $rendererLibraryPath)) {
|
||||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -35,7 +35,7 @@ foreach ($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
$helper->log("Load Test from $inputFileType file ", $inputFileNameShort);
|
$helper->log("Load Test from $inputFileType file ", $inputFileNameShort);
|
||||||
|
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$reader->setIncludeCharts(true);
|
$reader->setIncludeCharts(true);
|
||||||
$spreadsheet = $reader->load($inputFileName);
|
$spreadsheet = $reader->load($inputFileName);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -23,7 +23,7 @@ $spreadsheet->setActiveSheetIndex(0)
|
||||||
->setCellValue('B2', 'world!');
|
->setCellValue('B2', 'world!');
|
||||||
|
|
||||||
// Set the page layout view as page layout
|
// Set the page layout view as page layout
|
||||||
$spreadsheet->getActiveSheet()->getSheetView()->setView(PhpSpreadsheet\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT);
|
$spreadsheet->getActiveSheet()->getSheetView()->setView(\PhpOffice\PhpSpreadsheet\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
$helper->write($spreadsheet, __FILE__);
|
$helper->write($spreadsheet, __FILE__);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -39,7 +39,7 @@ foreach ($continents as $key => $filename) {
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
->fromArray($countries, null, $column . '1');
|
->fromArray($countries, null, $column . '1');
|
||||||
$spreadsheet->addNamedRange(
|
$spreadsheet->addNamedRange(
|
||||||
new PhpSpreadsheet\NamedRange(
|
new \PhpOffice\PhpSpreadsheet\NamedRange(
|
||||||
$continent,
|
$continent,
|
||||||
$spreadsheet->getActiveSheet(),
|
$spreadsheet->getActiveSheet(),
|
||||||
$column . '1:' . $column . $countryCount
|
$column . '1:' . $column . $countryCount
|
||||||
|
@ -61,7 +61,7 @@ $spreadsheet->getActiveSheet()
|
||||||
->setVisible(false);
|
->setVisible(false);
|
||||||
|
|
||||||
$spreadsheet->addNamedRange(
|
$spreadsheet->addNamedRange(
|
||||||
new PhpSpreadsheet\NamedRange(
|
new \PhpOffice\PhpSpreadsheet\NamedRange(
|
||||||
'Continents',
|
'Continents',
|
||||||
$spreadsheet->getActiveSheet(),
|
$spreadsheet->getActiveSheet(),
|
||||||
$continentColumn . '1:' . $continentColumn . count($continents)
|
$continentColumn . '1:' . $continentColumn . count($continents)
|
||||||
|
@ -85,8 +85,8 @@ $spreadsheet->getActiveSheet()
|
||||||
$validation = $spreadsheet->getActiveSheet()
|
$validation = $spreadsheet->getActiveSheet()
|
||||||
->getCell('B1')
|
->getCell('B1')
|
||||||
->getDataValidation();
|
->getDataValidation();
|
||||||
$validation->setType(PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
|
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
|
||||||
->setErrorStyle(PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
|
->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
|
||||||
->setAllowBlank(false)
|
->setAllowBlank(false)
|
||||||
->setShowInputMessage(true)
|
->setShowInputMessage(true)
|
||||||
->setShowErrorMessage(true)
|
->setShowErrorMessage(true)
|
||||||
|
@ -106,8 +106,8 @@ $spreadsheet->getActiveSheet()
|
||||||
$validation = $spreadsheet->getActiveSheet()
|
$validation = $spreadsheet->getActiveSheet()
|
||||||
->getCell('B3')
|
->getCell('B3')
|
||||||
->getDataValidation();
|
->getDataValidation();
|
||||||
$validation->setType(PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
|
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
|
||||||
->setErrorStyle(PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
|
->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
|
||||||
->setAllowBlank(false)
|
->setAllowBlank(false)
|
||||||
->setShowInputMessage(true)
|
->setShowInputMessage(true)
|
||||||
->setShowErrorMessage(true)
|
->setShowErrorMessage(true)
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
require __DIR__ . '/Header.php';
|
require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$helper->log('Create styles array');
|
$helper->log('Create styles array');
|
||||||
$styles = [];
|
$styles = [];
|
||||||
for ($i = 0; $i < 10; ++$i) {
|
for ($i = 0; $i < 10; ++$i) {
|
||||||
$style = new \PhpSpreadsheet\Style();
|
$style = new \PhpOffice\PhpSpreadsheet\Style();
|
||||||
$style->getFont()->setSize($i + 4);
|
$style->getFont()->setSize($i + 4);
|
||||||
$styles[] = $style;
|
$styles[] = $style;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ for ($col = 0; $col < 50; ++$col) {
|
||||||
for ($row = 0; $row < 100; ++$row) {
|
for ($row = 0; $row < 100; ++$row) {
|
||||||
$str = ($row + $col);
|
$str = ($row + $col);
|
||||||
$style = $styles[$row % 10];
|
$style = $styles[$row % 10];
|
||||||
$coord = \PhpSpreadsheet\Cell::stringFromColumnIndex($col) . ($row + 1);
|
$coord = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col) . ($row + 1);
|
||||||
$worksheet->setCellValue($coord, $str);
|
$worksheet->setCellValue($coord, $str);
|
||||||
$worksheet->duplicateStyle($style, $coord);
|
$worksheet->duplicateStyle($style, $coord);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -48,7 +48,7 @@ $html4 = 'H<sub>2</sub>SO<sub>4</sub> is the chemical formula for Sulphuric acid
|
||||||
|
|
||||||
$html5 = '<strong>bold</strong>, <em>italic</em>, <strong><em>bold+italic</em></strong>';
|
$html5 = '<strong>bold</strong>, <em>italic</em>, <strong><em>bold+italic</em></strong>';
|
||||||
|
|
||||||
$wizard = new \PhpSpreadsheet\Helper\HTML();
|
$wizard = new \PhpOffice\PhpSpreadsheet\Helper\HTML();
|
||||||
$richText = $wizard->toRichTextObject($html1);
|
$richText = $wizard->toRichTextObject($html1);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()
|
$spreadsheet->getActiveSheet()
|
||||||
|
|
|
@ -5,13 +5,13 @@ require __DIR__ . '/Header.php';
|
||||||
$helper->log('Load MergeBook1 from Excel2007 file');
|
$helper->log('Load MergeBook1 from Excel2007 file');
|
||||||
$filename1 = __DIR__ . '/templates/43mergeBook1.xlsx';
|
$filename1 = __DIR__ . '/templates/43mergeBook1.xlsx';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet1 = \PhpSpreadsheet\IOFactory::load($filename1);
|
$spreadsheet1 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename1);
|
||||||
$helper->logRead('Excel2007', $filename1, $callStartTime);
|
$helper->logRead('Excel2007', $filename1, $callStartTime);
|
||||||
|
|
||||||
$helper->log('Load MergeBook2 from Excel2007 file');
|
$helper->log('Load MergeBook2 from Excel2007 file');
|
||||||
$filename2 = __DIR__ . '/templates/43mergeBook2.xlsx';
|
$filename2 = __DIR__ . '/templates/43mergeBook2.xlsx';
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$spreadsheet2 = \PhpSpreadsheet\IOFactory::load($filename2);
|
$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename2);
|
||||||
$helper->logRead('Excel2007', $filename2, $callStartTime);
|
$helper->logRead('Excel2007', $filename2, $callStartTime);
|
||||||
|
|
||||||
foreach ($spreadsheet2->getSheetNames() as $sheetName) {
|
foreach ($spreadsheet2->getSheetNames() as $sheetName) {
|
||||||
|
|
|
@ -5,11 +5,11 @@ require __DIR__ . '/Header.php';
|
||||||
// Create temporary file that will be read
|
// Create temporary file that will be read
|
||||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||||
$filename = $helper->getTemporaryFilename();
|
$filename = $helper->getTemporaryFilename();
|
||||||
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
||||||
$inputFileType = \PhpSpreadsheet\IOFactory::identify($filename);
|
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
|
||||||
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||||
$sheetList = $reader->listWorksheetNames($filename);
|
$sheetList = $reader->listWorksheetNames($filename);
|
||||||
$sheetInfo = $reader->listWorksheetInfo($filename);
|
$sheetInfo = $reader->listWorksheetInfo($filename);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
require_once __DIR__ . '/../src/Bootstrap.php';
|
require_once __DIR__ . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$helper = new \PhpSpreadsheet\Helper\Sample();
|
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
|
||||||
if (!defined('EOL')) {
|
if (!defined('EOL')) {
|
||||||
define('EOL', $helper->isCli() ? PHP_EOL : '<br />');
|
define('EOL', $helper->isCli() ? PHP_EOL : '<br />');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$worksheet->fromArray(
|
$worksheet->fromArray(
|
||||||
[
|
[
|
||||||
|
@ -20,9 +20,9 @@ $worksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = [
|
$dataSeriesLabels = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
|
||||||
];
|
];
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -32,7 +32,7 @@ $dataSeriesLabels = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = [
|
$xAxisTickValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
|
||||||
];
|
];
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -42,15 +42,15 @@ $xAxisTickValues = [
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = [
|
$dataSeriesValues = [
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
|
||||||
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new \PhpSpreadsheet\Chart\DataSeries(
|
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
|
||||||
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues) - 1), // plotOrder
|
range(0, count($dataSeriesValues) - 1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -58,18 +58,18 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a horizontal bar rather than a vertical column graph
|
// Make it a horizontal bar rather than a vertical column graph
|
||||||
$series->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_BAR);
|
$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_BAR);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new \PhpSpreadsheet\Chart\Legend(\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
|
||||||
|
|
||||||
$title = new \PhpSpreadsheet\Chart\Title('Test Bar Chart');
|
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Bar Chart');
|
||||||
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
|
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new \PhpSpreadsheet\Chart(
|
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set properties');
|
$helper->log('Set properties');
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Create new Spreadsheet object
|
// Create new Spreadsheet object
|
||||||
$helper->log('Create new Spreadsheet object');
|
$helper->log('Create new Spreadsheet object');
|
||||||
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$helper->log('Set document properties');
|
$helper->log('Set document properties');
|
||||||
|
@ -18,8 +18,8 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
|
||||||
$helper->log('Add some data');
|
$helper->log('Add some data');
|
||||||
$spreadsheet->setActiveSheetIndex(0);
|
$spreadsheet->setActiveSheetIndex(0);
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('B1', 'Invoice');
|
$spreadsheet->getActiveSheet()->setCellValue('B1', 'Invoice');
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('D1', \PhpSpreadsheet\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, date('m'), date('d'), date('Y'))));
|
$spreadsheet->getActiveSheet()->setCellValue('D1', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, date('m'), date('d'), date('Y'))));
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15);
|
$spreadsheet->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15);
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('E1', '#12566');
|
$spreadsheet->getActiveSheet()->setCellValue('E1', '#12566');
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('A3', 'Product Id');
|
$spreadsheet->getActiveSheet()->setCellValue('A3', 'Product Id');
|
||||||
|
@ -81,13 +81,13 @@ $spreadsheet->getActiveSheet()->getComment('E13')->getFillColor()->setRGB('EEEEE
|
||||||
|
|
||||||
// Add rich-text string
|
// Add rich-text string
|
||||||
$helper->log('Add rich-text string');
|
$helper->log('Add rich-text string');
|
||||||
$richText = new \PhpSpreadsheet\RichText();
|
$richText = new \PhpOffice\PhpSpreadsheet\RichText();
|
||||||
$richText->createText('This invoice is ');
|
$richText->createText('This invoice is ');
|
||||||
|
|
||||||
$payable = $richText->createTextRun('payable within thirty days after the end of the month');
|
$payable = $richText->createTextRun('payable within thirty days after the end of the month');
|
||||||
$payable->getFont()->setBold(true);
|
$payable->getFont()->setBold(true);
|
||||||
$payable->getFont()->setItalic(true);
|
$payable->getFont()->setItalic(true);
|
||||||
$payable->getFont()->setColor(new \PhpSpreadsheet\Style\Color(\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN));
|
$payable->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN));
|
||||||
|
|
||||||
$richText->createText(', unless specified otherwise on the invoice.');
|
$richText->createText(', unless specified otherwise on the invoice.');
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ $spreadsheet->getActiveSheet()->protectCells('A3:E13', 'PhpSpreadsheet');
|
||||||
|
|
||||||
// Set cell number formats
|
// Set cell number formats
|
||||||
$helper->log('Set cell number formats');
|
$helper->log('Set cell number formats');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$spreadsheet->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
// Set column widths
|
// Set column widths
|
||||||
$helper->log('Set column widths');
|
$helper->log('Set column widths');
|
||||||
|
@ -118,23 +118,23 @@ $helper->log('Set fonts');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');
|
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setSize(20);
|
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setSize(20);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
|
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
|
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_WHITE);
|
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_WHITE);
|
$spreadsheet->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_WHITE);
|
$spreadsheet->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D13')->getFont()->setBold(true);
|
$spreadsheet->getActiveSheet()->getStyle('D13')->getFont()->setBold(true);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
|
$spreadsheet->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
|
||||||
|
|
||||||
// Set alignments
|
// Set alignments
|
||||||
$helper->log('Set alignments');
|
$helper->log('Set alignments');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
$spreadsheet->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
$spreadsheet->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
$spreadsheet->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_JUSTIFY);
|
$spreadsheet->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_JUSTIFY);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
$spreadsheet->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true);
|
$spreadsheet->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ $helper->log('Set thin black border outline around column');
|
||||||
$styleThinBlackBorderOutline = [
|
$styleThinBlackBorderOutline = [
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'outline' => [
|
'outline' => [
|
||||||
'style' => \PhpSpreadsheet\Style\Border::BORDER_THIN,
|
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
'color' => ['argb' => 'FF000000'],
|
'color' => ['argb' => 'FF000000'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -155,7 +155,7 @@ $helper->log('Set thick brown border outline around Total');
|
||||||
$styleThickBrownBorderOutline = [
|
$styleThickBrownBorderOutline = [
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'outline' => [
|
'outline' => [
|
||||||
'style' => \PhpSpreadsheet\Style\Border::BORDER_THICK,
|
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
|
||||||
'color' => ['argb' => 'FF993300'],
|
'color' => ['argb' => 'FF993300'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -164,7 +164,7 @@ $spreadsheet->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickB
|
||||||
|
|
||||||
// Set fills
|
// Set fills
|
||||||
$helper->log('Set fills');
|
$helper->log('Set fills');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(\PhpSpreadsheet\Style\Fill::FILL_SOLID);
|
$spreadsheet->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080');
|
$spreadsheet->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080');
|
||||||
|
|
||||||
// Set style for header row using alternative method
|
// Set style for header row using alternative method
|
||||||
|
@ -175,15 +175,15 @@ $spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
|
||||||
'bold' => true,
|
'bold' => true,
|
||||||
],
|
],
|
||||||
'alignment' => [
|
'alignment' => [
|
||||||
'horizontal' => \PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
|
||||||
],
|
],
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'top' => [
|
'top' => [
|
||||||
'style' => \PhpSpreadsheet\Style\Border::BORDER_THIN,
|
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'fill' => [
|
'fill' => [
|
||||||
'type' => \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
|
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
|
||||||
'rotation' => 90,
|
'rotation' => 90,
|
||||||
'startcolor' => [
|
'startcolor' => [
|
||||||
'argb' => 'FFA0A0A0',
|
'argb' => 'FFA0A0A0',
|
||||||
|
@ -198,11 +198,11 @@ $spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray(
|
$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray(
|
||||||
[
|
[
|
||||||
'alignment' => [
|
'alignment' => [
|
||||||
'horizontal' => \PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
|
||||||
],
|
],
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'left' => [
|
'left' => [
|
||||||
'style' => \PhpSpreadsheet\Style\Border::BORDER_THIN,
|
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
@ -211,7 +211,7 @@ $spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray(
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B3')->applyFromArray(
|
$spreadsheet->getActiveSheet()->getStyle('B3')->applyFromArray(
|
||||||
[
|
[
|
||||||
'alignment' => [
|
'alignment' => [
|
||||||
'horizontal' => \PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -220,7 +220,7 @@ $spreadsheet->getActiveSheet()->getStyle('E3')->applyFromArray(
|
||||||
[
|
[
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'right' => [
|
'right' => [
|
||||||
'style' => \PhpSpreadsheet\Style\Border::BORDER_THIN,
|
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
@ -228,24 +228,24 @@ $spreadsheet->getActiveSheet()->getStyle('E3')->applyFromArray(
|
||||||
|
|
||||||
// Unprotect a cell
|
// Unprotect a cell
|
||||||
$helper->log('Unprotect a cell');
|
$helper->log('Unprotect a cell');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED);
|
$spreadsheet->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(\PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED);
|
||||||
|
|
||||||
// Add a hyperlink to the sheet
|
// Add a hyperlink to the sheet
|
||||||
$helper->log('Add a hyperlink to an external website');
|
$helper->log('Add a hyperlink to an external website');
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
|
$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
|
||||||
$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
|
$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
|
||||||
$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website');
|
$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
$spreadsheet->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
|
|
||||||
$helper->log('Add a hyperlink to another cell on a different worksheet within the workbook');
|
$helper->log('Add a hyperlink to another cell on a different worksheet within the workbook');
|
||||||
$spreadsheet->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
|
$spreadsheet->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
|
||||||
$spreadsheet->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
|
$spreadsheet->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
|
||||||
$spreadsheet->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions');
|
$spreadsheet->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
$spreadsheet->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
$helper->log('Add a drawing to the worksheet');
|
$helper->log('Add a drawing to the worksheet');
|
||||||
$drawing = new \PhpSpreadsheet\Worksheet\Drawing();
|
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
|
||||||
$drawing->setName('Logo');
|
$drawing->setName('Logo');
|
||||||
$drawing->setDescription('Logo');
|
$drawing->setDescription('Logo');
|
||||||
$drawing->setPath(__DIR__ . '/../images/officelogo.jpg');
|
$drawing->setPath(__DIR__ . '/../images/officelogo.jpg');
|
||||||
|
@ -254,7 +254,7 @@ $drawing->setWorksheet($spreadsheet->getActiveSheet());
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
$helper->log('Add a drawing to the worksheet');
|
$helper->log('Add a drawing to the worksheet');
|
||||||
$drawing = new \PhpSpreadsheet\Worksheet\Drawing();
|
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
|
||||||
$drawing->setName('Paid');
|
$drawing->setName('Paid');
|
||||||
$drawing->setDescription('Paid');
|
$drawing->setDescription('Paid');
|
||||||
$drawing->setPath(__DIR__ . '/../images/paid.png');
|
$drawing->setPath(__DIR__ . '/../images/paid.png');
|
||||||
|
@ -267,7 +267,7 @@ $drawing->setWorksheet($spreadsheet->getActiveSheet());
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
$helper->log('Add a drawing to the worksheet');
|
$helper->log('Add a drawing to the worksheet');
|
||||||
$drawing = new \PhpSpreadsheet\Worksheet\Drawing();
|
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
|
||||||
$drawing->setName('PhpSpreadsheet logo');
|
$drawing->setName('PhpSpreadsheet logo');
|
||||||
$drawing->setDescription('PhpSpreadsheet logo');
|
$drawing->setDescription('PhpSpreadsheet logo');
|
||||||
$drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.gif');
|
$drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.gif');
|
||||||
|
@ -290,8 +290,8 @@ $spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spread
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
$helper->log('Set page orientation and size');
|
$helper->log('Set page orientation and size');
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename first worksheet
|
// Rename first worksheet
|
||||||
$helper->log('Rename first worksheet');
|
$helper->log('Rename first worksheet');
|
||||||
|
@ -330,13 +330,13 @@ $helper->log('Set fonts');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
|
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
|
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
|
$spreadsheet->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
|
||||||
|
|
||||||
$spreadsheet->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8);
|
$spreadsheet->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8);
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
$helper->log('Add a drawing to the worksheet');
|
$helper->log('Add a drawing to the worksheet');
|
||||||
$drawing = new \PhpSpreadsheet\Worksheet\Drawing();
|
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
|
||||||
$drawing->setName('Terms and conditions');
|
$drawing->setName('Terms and conditions');
|
||||||
$drawing->setDescription('Terms and conditions');
|
$drawing->setDescription('Terms and conditions');
|
||||||
$drawing->setPath(__DIR__ . '/../images/termsconditions.jpg');
|
$drawing->setPath(__DIR__ . '/../images/termsconditions.jpg');
|
||||||
|
@ -345,8 +345,8 @@ $drawing->setWorksheet($spreadsheet->getActiveSheet());
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
$helper->log('Set page orientation and size');
|
$helper->log('Set page orientation and size');
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename second worksheet
|
// Rename second worksheet
|
||||||
$helper->log('Rename second worksheet');
|
$helper->log('Rename second worksheet');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet;
|
namespace PhpOffice\PhpSpreadsheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoloader for PhpSpreadsheet classes
|
* Autoloader for PhpSpreadsheet classes
|
||||||
|
@ -38,7 +38,7 @@ class Autoloader
|
||||||
spl_autoload_register('__autoload');
|
spl_autoload_register('__autoload');
|
||||||
}
|
}
|
||||||
// Register ourselves with SPL
|
// Register ourselves with SPL
|
||||||
return spl_autoload_register([\PhpSpreadsheet\Autoloader::class, 'load'], true, true);
|
return spl_autoload_register([\PhpOffice\PhpSpreadsheet\Autoloader::class, 'load'], true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,14 +48,15 @@ class Autoloader
|
||||||
*/
|
*/
|
||||||
public static function load($className)
|
public static function load($className)
|
||||||
{
|
{
|
||||||
if ((class_exists($className, false)) || (strpos($className, 'PhpSpreadsheet\\') !== 0)) {
|
$prefix = 'PhpOffice\\PhpSpreadsheet\\';
|
||||||
|
if ((class_exists($className, false)) || (strpos($className, $prefix) !== 0)) {
|
||||||
// Either already loaded, or not a PhpSpreadsheet class request
|
// Either already loaded, or not a PhpSpreadsheet class request
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$classFilePath = __DIR__ . DIRECTORY_SEPARATOR .
|
$classFilePath = __DIR__ . DIRECTORY_SEPARATOR .
|
||||||
'PhpSpreadsheet' . DIRECTORY_SEPARATOR .
|
'PhpSpreadsheet' . DIRECTORY_SEPARATOR .
|
||||||
str_replace(['PhpSpreadsheet\\', '\\'], ['', '/'], $className) .
|
str_replace([$prefix, '\\'], ['', '/'], $className) .
|
||||||
'.php';
|
'.php';
|
||||||
|
|
||||||
if ((file_exists($classFilePath) === false) || (is_readable($classFilePath) === false)) {
|
if ((file_exists($classFilePath) === false) || (is_readable($classFilePath) === false)) {
|
||||||
|
|
|
@ -26,4 +26,4 @@
|
||||||
*/
|
*/
|
||||||
include_once __DIR__ . '/Autoloader.php';
|
include_once __DIR__ . '/Autoloader.php';
|
||||||
|
|
||||||
\PhpSpreadsheet\Autoloader::register();
|
\PhpOffice\PhpSpreadsheet\Autoloader::register();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -44,7 +44,7 @@ class APC extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ class APC extends CacheBase implements ICache
|
||||||
$this->cacheTime
|
$this->cacheTime
|
||||||
)) {
|
)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in APC');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in APC');
|
||||||
}
|
}
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,11 @@ class APC extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -87,10 +87,10 @@ class APC extends CacheBase implements ICache
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a value set in the current \PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
|
@ -105,7 +105,7 @@ class APC extends CacheBase implements ICache
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in APC, so clear it from the cache array
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -118,8 +118,8 @@ class APC extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,7 @@ class APC extends CacheBase implements ICache
|
||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in APC, so clear it from the cache array
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
@ -169,7 +169,7 @@ class APC extends CacheBase implements ICache
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -183,10 +183,10 @@ class APC extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
// Get a new id for the new file name
|
// Get a new id for the new file name
|
||||||
|
@ -199,11 +199,11 @@ class APC extends CacheBase implements ICache
|
||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in APC, so clear it from the cache array
|
// Entry no longer exists in APC, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in APC');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in APC');
|
||||||
}
|
}
|
||||||
if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
|
if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in APC');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in APC');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,10 +232,10 @@ class APC extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @param array of mixed $arguments Additional initialisation arguments
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -29,14 +29,14 @@ abstract class CacheBase
|
||||||
/**
|
/**
|
||||||
* Parent worksheet
|
* Parent worksheet
|
||||||
*
|
*
|
||||||
* @var \PhpSpreadsheet\Worksheet
|
* @var \PhpOffice\PhpSpreadsheet\Worksheet
|
||||||
*/
|
*/
|
||||||
protected $parent;
|
protected $parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently active Cell
|
* The currently active Cell
|
||||||
*
|
*
|
||||||
* @var \PhpSpreadsheet\Cell
|
* @var \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
protected $currentObject = null;
|
protected $currentObject = null;
|
||||||
|
|
||||||
|
@ -65,12 +65,12 @@ abstract class CacheBase
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
// Set our parent worksheet.
|
// Set our parent worksheet.
|
||||||
// This is maintained within the cache controller to facilitate re-attaching it to \PhpSpreadsheet\Cell objects when
|
// This is maintained within the cache controller to facilitate re-attaching it to \PhpOffice\PhpSpreadsheet\Cell objects when
|
||||||
// they are woken from a serialized state
|
// they are woken from a serialized state
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ abstract class CacheBase
|
||||||
/**
|
/**
|
||||||
* Return the parent worksheet for this cell collection
|
* Return the parent worksheet for this cell collection
|
||||||
*
|
*
|
||||||
* @return \PhpSpreadsheet\Worksheet
|
* @return \PhpOffice\PhpSpreadsheet\Worksheet
|
||||||
*/
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ abstract class CacheBase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a value set in the current \PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -124,11 +124,11 @@ abstract class CacheBase
|
||||||
/**
|
/**
|
||||||
* Add or Update a cell in cache
|
* Add or Update a cell in cache
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function updateCacheData(\PhpSpreadsheet\Cell $cell)
|
public function updateCacheData(\PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
return $this->addCacheData($cell->getCoordinate(), $cell);
|
return $this->addCacheData($cell->getCoordinate(), $cell);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ abstract class CacheBase
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -262,10 +262,10 @@ abstract class CacheBase
|
||||||
if ($r != $row) {
|
if ($r != $row) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$columnList[] = \PhpSpreadsheet\Cell::columnIndexFromString($c);
|
$columnList[] = \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($c);
|
||||||
}
|
}
|
||||||
|
|
||||||
return \PhpSpreadsheet\Cell::stringFromColumnIndex(max($columnList) - 1);
|
return \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex(max($columnList) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,9 +314,9 @@ abstract class CacheBase
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
$this->currentCellIsDirty;
|
$this->currentCellIsDirty;
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -51,7 +51,7 @@ class DiscISAM extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -73,11 +73,11 @@ class DiscISAM extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -94,8 +94,8 @@ class DiscISAM extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -138,9 +138,9 @@ class DiscISAM extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
// Get a new id for the new file name
|
// Get a new id for the new file name
|
||||||
|
@ -174,14 +174,14 @@ class DiscISAM extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @param array of mixed $arguments Additional initialisation arguments
|
* @param array of mixed $arguments Additional initialisation arguments
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
|
$this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
|
||||||
? $arguments['dir']
|
? $arguments['dir']
|
||||||
: \PhpSpreadsheet\Shared\File::sysGetTempDir();
|
: \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
|
||||||
|
|
||||||
parent::__construct($parent);
|
parent::__construct($parent);
|
||||||
if (is_null($this->fileHandle)) {
|
if (is_null($this->fileHandle)) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -30,27 +30,27 @@ interface ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell);
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or Update a cell in cache
|
* Add or Update a cell in cache
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function updateCacheData(\PhpSpreadsheet\Cell $cell);
|
public function updateCacheData(\PhpOffice\PhpSpreadsheet\Cell $cell);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a cell from cache identified by coordinate address
|
* Fetch a cell from cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to retrieve
|
* @param string $pCoord Coordinate address of the cell to retrieve
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord);
|
public function getCacheData($pCoord);
|
||||||
|
|
||||||
|
@ -58,12 +58,12 @@ interface ICache
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord);
|
public function deleteCacheData($pCoord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a value set in the current \PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -87,9 +87,9 @@ interface ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent);
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify whether the caching method is currently available
|
* Identify whether the caching method is currently available
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -30,7 +30,7 @@ class Igbinary extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -47,11 +47,11 @@ class Igbinary extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -68,8 +68,8 @@ class Igbinary extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -51,7 +51,7 @@ class Memcache extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ class Memcache extends CacheBase implements ICache
|
||||||
if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
||||||
if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception("Failed to store cell {$this->currentObjectID} in MemCache");
|
throw new \PhpOffice\PhpSpreadsheet\Exception("Failed to store cell {$this->currentObjectID} in MemCache");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
|
@ -74,11 +74,11 @@ class Memcache extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -93,10 +93,10 @@ class Memcache extends CacheBase implements ICache
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a value set in the current \PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
|
@ -111,7 +111,7 @@ class Memcache extends CacheBase implements ICache
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in MemCache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in MemCache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -124,8 +124,8 @@ class Memcache extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ class Memcache extends CacheBase implements ICache
|
||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new \PhpSpreadsheet\Exception("Cell entry {$pCoord} no longer exists in MemCache");
|
throw new \PhpOffice\PhpSpreadsheet\Exception("Cell entry {$pCoord} no longer exists in MemCache");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
@ -175,7 +175,7 @@ class Memcache extends CacheBase implements ICache
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -189,10 +189,10 @@ class Memcache extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
// Get a new id for the new file name
|
// Get a new id for the new file name
|
||||||
|
@ -205,11 +205,11 @@ class Memcache extends CacheBase implements ICache
|
||||||
if ($obj === false) {
|
if ($obj === false) {
|
||||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new \PhpSpreadsheet\Exception("Cell entry {$cellID} no longer exists in MemCache");
|
throw new \PhpOffice\PhpSpreadsheet\Exception("Cell entry {$cellID} no longer exists in MemCache");
|
||||||
}
|
}
|
||||||
if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) {
|
if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception("Failed to store cell {$cellID} in MemCache");
|
throw new \PhpOffice\PhpSpreadsheet\Exception("Failed to store cell {$cellID} in MemCache");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,11 +238,11 @@ class Memcache extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @param mixed[] $arguments Additional initialisation arguments
|
* @param mixed[] $arguments Additional initialisation arguments
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
|
$memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
|
||||||
$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
|
$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
|
||||||
|
@ -255,7 +255,7 @@ class Memcache extends CacheBase implements ICache
|
||||||
// Set a new Memcache object and connect to the Memcache server
|
// Set a new Memcache object and connect to the Memcache server
|
||||||
$this->memcache = new self();
|
$this->memcache = new self();
|
||||||
if (!$this->memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, [$this, 'failureCallback'])) {
|
if (!$this->memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, [$this, 'failureCallback'])) {
|
||||||
throw new \PhpSpreadsheet\Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}");
|
throw new \PhpOffice\PhpSpreadsheet\Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}");
|
||||||
}
|
}
|
||||||
$this->cacheTime = $cacheTime;
|
$this->cacheTime = $cacheTime;
|
||||||
|
|
||||||
|
@ -268,11 +268,11 @@ class Memcache extends CacheBase implements ICache
|
||||||
*
|
*
|
||||||
* @param string $host Memcache server
|
* @param string $host Memcache server
|
||||||
* @param int $port Memcache port
|
* @param int $port Memcache port
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function failureCallback($host, $port)
|
public function failureCallback($host, $port)
|
||||||
{
|
{
|
||||||
throw new \PhpSpreadsheet\Exception("memcache {$host}:{$port} failed");
|
throw new \PhpOffice\PhpSpreadsheet\Exception("memcache {$host}:{$port} failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -37,11 +37,11 @@ class Memory extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
$this->cellCache[$pCoord] = $cell;
|
$this->cellCache[$pCoord] = $cell;
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ class Memory extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -77,9 +77,9 @@ class Memory extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -30,7 +30,7 @@ class MemoryGZip extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -47,11 +47,11 @@ class MemoryGZip extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -68,8 +68,8 @@ class MemoryGZip extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -30,7 +30,7 @@ class MemorySerialized extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -47,11 +47,11 @@ class MemorySerialized extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -68,8 +68,8 @@ class MemorySerialized extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -44,7 +44,7 @@ class PHPTemp extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -66,11 +66,11 @@ class PHPTemp extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -87,8 +87,8 @@ class PHPTemp extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -131,9 +131,9 @@ class PHPTemp extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
// Open a new stream for the cell cache data
|
// Open a new stream for the cell cache data
|
||||||
|
@ -167,10 +167,10 @@ class PHPTemp extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @param mixed[] $arguments Additional initialisation arguments
|
* @param mixed[] $arguments Additional initialisation arguments
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : 1 * 1024 * 1024;
|
$this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : 1 * 1024 * 1024;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -44,7 +44,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
$this->currentObject->detach();
|
$this->currentObject->detach();
|
||||||
|
|
||||||
if (!$this->DBHandle->queryExec('INSERT OR REPLACE INTO kvp_' . $this->TableName . " VALUES('" . $this->currentObjectID . "','" . sqlite_escape_string(serialize($this->currentObject)) . "')")) {
|
if (!$this->DBHandle->queryExec('INSERT OR REPLACE INTO kvp_' . $this->TableName . " VALUES('" . $this->currentObjectID . "','" . sqlite_escape_string(serialize($this->currentObject)) . "')")) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -63,11 +63,11 @@ class SQLite extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -84,8 +84,8 @@ class SQLite extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
$query = 'SELECT value FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
|
$query = 'SELECT value FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
|
||||||
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
||||||
if ($cellResultSet === false) {
|
if ($cellResultSet === false) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
} elseif ($cellResultSet->numRows() == 0) {
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return null;
|
return null;
|
||||||
|
@ -119,7 +119,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
* Is a value set for an indexed cell?
|
* Is a value set for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
|
@ -132,7 +132,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
$query = 'SELECT id FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
|
$query = 'SELECT id FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
|
||||||
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
||||||
if ($cellResultSet === false) {
|
if ($cellResultSet === false) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
} elseif ($cellResultSet->numRows() == 0) {
|
} elseif ($cellResultSet->numRows() == 0) {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,7 +145,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
// Check if the requested entry exists in the cache
|
// Check if the requested entry exists in the cache
|
||||||
$query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
|
$query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
|
||||||
if (!$this->DBHandle->queryExec($query)) {
|
if (!$this->DBHandle->queryExec($query)) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
|
@ -168,7 +168,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
*
|
*
|
||||||
* @param string $fromAddress Current address of the cell to move
|
* @param string $fromAddress Current address of the cell to move
|
||||||
* @param string $toAddress Destination address of the cell to move
|
* @param string $toAddress Destination address of the cell to move
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function moveCell($fromAddress, $toAddress)
|
public function moveCell($fromAddress, $toAddress)
|
||||||
|
@ -180,13 +180,13 @@ class SQLite extends CacheBase implements ICache
|
||||||
$query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $toAddress . "'";
|
$query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $toAddress . "'";
|
||||||
$result = $this->DBHandle->exec($query);
|
$result = $this->DBHandle->exec($query);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = 'UPDATE kvp_' . $this->TableName . " SET id='" . $toAddress . "' WHERE id='" . $fromAddress . "'";
|
$query = 'UPDATE kvp_' . $this->TableName . " SET id='" . $toAddress . "' WHERE id='" . $fromAddress . "'";
|
||||||
$result = $this->DBHandle->exec($query);
|
$result = $this->DBHandle->exec($query);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -195,7 +195,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Get a list of all cell addresses currently held in cache
|
* Get a list of all cell addresses currently held in cache
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
|
@ -207,7 +207,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
$query = 'SELECT id FROM kvp_' . $this->TableName;
|
$query = 'SELECT id FROM kvp_' . $this->TableName;
|
||||||
$cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
|
$cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
|
||||||
if ($cellIdsResult === false) {
|
if ($cellIdsResult === false) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cellKeys = [];
|
$cellKeys = [];
|
||||||
|
@ -221,10 +221,10 @@ class SQLite extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
$this->currentCellIsDirty;
|
$this->currentCellIsDirty;
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -234,7 +234,7 @@ class SQLite extends CacheBase implements ICache
|
||||||
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
AS SELECT * FROM kvp_' . $this->TableName)
|
AS SELECT * FROM kvp_' . $this->TableName)
|
||||||
) {
|
) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the existing cell cache file
|
// Copy the existing cell cache file
|
||||||
|
@ -260,10 +260,10 @@ class SQLite extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::__construct($parent);
|
parent::__construct($parent);
|
||||||
if (is_null($this->DBHandle)) {
|
if (is_null($this->DBHandle)) {
|
||||||
|
@ -272,10 +272,10 @@ class SQLite extends CacheBase implements ICache
|
||||||
|
|
||||||
$this->DBHandle = new SQLiteDatabase($_DBName);
|
$this->DBHandle = new SQLiteDatabase($_DBName);
|
||||||
if ($this->DBHandle === false) {
|
if ($this->DBHandle === false) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
||||||
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -72,7 +72,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
|
$this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
|
||||||
$result = $this->insertQuery->execute();
|
$result = $this->insertQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -94,11 +94,11 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -115,9 +115,9 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||||
$cellResult = $this->selectQuery->execute();
|
$cellResult = $this->selectQuery->execute();
|
||||||
if ($cellResult === false) {
|
if ($cellResult === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
if ($cellData === false) {
|
if ($cellData === false) {
|
||||||
|
@ -152,7 +152,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
* Is a value set for an indexed cell?
|
* Is a value set for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
|
@ -165,7 +165,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||||
$cellResult = $this->selectQuery->execute();
|
$cellResult = $this->selectQuery->execute();
|
||||||
if ($cellResult === false) {
|
if ($cellResult === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +189,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
$this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||||
$result = $this->deleteQuery->execute();
|
$result = $this->deleteQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
|
@ -200,7 +200,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
*
|
*
|
||||||
* @param string $fromAddress Current address of the cell to move
|
* @param string $fromAddress Current address of the cell to move
|
||||||
* @param string $toAddress Destination address of the cell to move
|
* @param string $toAddress Destination address of the cell to move
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function moveCell($fromAddress, $toAddress)
|
public function moveCell($fromAddress, $toAddress)
|
||||||
|
@ -212,14 +212,14 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
|
$this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
|
||||||
$result = $this->deleteQuery->execute();
|
$result = $this->deleteQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
|
$this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
|
||||||
$this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
|
$this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
|
||||||
$result = $this->updateQuery->execute();
|
$result = $this->updateQuery->execute();
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -228,7 +228,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Get a list of all cell addresses currently held in cache
|
* Get a list of all cell addresses currently held in cache
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getCellList()
|
public function getCellList()
|
||||||
|
@ -240,7 +240,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$query = 'SELECT id FROM kvp_' . $this->TableName;
|
$query = 'SELECT id FROM kvp_' . $this->TableName;
|
||||||
$cellIdsResult = $this->DBHandle->query($query);
|
$cellIdsResult = $this->DBHandle->query($query);
|
||||||
if ($cellIdsResult === false) {
|
if ($cellIdsResult === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
$cellKeys = [];
|
$cellKeys = [];
|
||||||
|
@ -254,10 +254,10 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
$this->currentCellIsDirty;
|
$this->currentCellIsDirty;
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -267,7 +267,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||||
AS SELECT * FROM kvp_' . $this->TableName)
|
AS SELECT * FROM kvp_' . $this->TableName)
|
||||||
) {
|
) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the existing cell cache file
|
// Copy the existing cell cache file
|
||||||
|
@ -293,10 +293,10 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::__construct($parent);
|
parent::__construct($parent);
|
||||||
if (is_null($this->DBHandle)) {
|
if (is_null($this->DBHandle)) {
|
||||||
|
@ -305,10 +305,10 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
|
|
||||||
$this->DBHandle = new \SQLite3($_DBName);
|
$this->DBHandle = new \SQLite3($_DBName);
|
||||||
if ($this->DBHandle === false) {
|
if ($this->DBHandle === false) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
||||||
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CachedObjectStorage;
|
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -44,7 +44,7 @@ class Wincache extends CacheBase implements ICache
|
||||||
* Store cell data in cache for the current cell object if it's "dirty",
|
* Store cell data in cache for the current cell object if it's "dirty",
|
||||||
* and the 'nullify' the current cell object
|
* and the 'nullify' the current cell object
|
||||||
*
|
*
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
protected function storeData()
|
protected function storeData()
|
||||||
{
|
{
|
||||||
|
@ -55,12 +55,12 @@ class Wincache extends CacheBase implements ICache
|
||||||
if (wincache_ucache_exists($this->cachePrefix . $this->currentObjectID . '.cache')) {
|
if (wincache_ucache_exists($this->cachePrefix . $this->currentObjectID . '.cache')) {
|
||||||
if (!wincache_ucache_set($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
|
if (!wincache_ucache_set($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!wincache_ucache_add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
|
if (!wincache_ucache_add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->currentCellIsDirty = false;
|
$this->currentCellIsDirty = false;
|
||||||
|
@ -73,11 +73,11 @@ class Wincache extends CacheBase implements ICache
|
||||||
* Add or Update a cell in cache identified by coordinate address
|
* Add or Update a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to update
|
* @param string $pCoord Coordinate address of the cell to update
|
||||||
* @param \PhpSpreadsheet\Cell $cell Cell to update
|
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell
|
* @return \PhpOffice\PhpSpreadsheet\Cell
|
||||||
*/
|
*/
|
||||||
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
|
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
|
||||||
{
|
{
|
||||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||||
$this->storeData();
|
$this->storeData();
|
||||||
|
@ -92,10 +92,10 @@ class Wincache extends CacheBase implements ICache
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a value set in the current \PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
* Is a value set in the current \PhpOffice\PhpSpreadsheet\CachedObjectStorage\ICache for an indexed cell?
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to check
|
* @param string $pCoord Coordinate address of the cell to check
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDataSet($pCoord)
|
public function isDataSet($pCoord)
|
||||||
|
@ -110,7 +110,7 @@ class Wincache extends CacheBase implements ICache
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in Wincache, so clear it from the cache array
|
// Entry no longer exists in Wincache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -123,8 +123,8 @@ class Wincache extends CacheBase implements ICache
|
||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate of the cell
|
* @param string $pCoord Coordinate of the cell
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
|
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
|
||||||
*/
|
*/
|
||||||
public function getCacheData($pCoord)
|
public function getCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ class Wincache extends CacheBase implements ICache
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
parent::deleteCacheData($pCoord);
|
parent::deleteCacheData($pCoord);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Return null if requested entry doesn't exist in cache
|
// Return null if requested entry doesn't exist in cache
|
||||||
|
@ -176,7 +176,7 @@ class Wincache extends CacheBase implements ICache
|
||||||
* Delete a cell in cache identified by coordinate address
|
* Delete a cell in cache identified by coordinate address
|
||||||
*
|
*
|
||||||
* @param string $pCoord Coordinate address of the cell to delete
|
* @param string $pCoord Coordinate address of the cell to delete
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteCacheData($pCoord)
|
public function deleteCacheData($pCoord)
|
||||||
{
|
{
|
||||||
|
@ -190,10 +190,10 @@ class Wincache extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Clone the cell collection
|
* Clone the cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
|
||||||
* @throws \PhpSpreadsheet\Exception
|
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||||
*/
|
*/
|
||||||
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
|
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
|
||||||
{
|
{
|
||||||
parent::copyCellCollection($parent);
|
parent::copyCellCollection($parent);
|
||||||
// Get a new id for the new file name
|
// Get a new id for the new file name
|
||||||
|
@ -207,11 +207,11 @@ class Wincache extends CacheBase implements ICache
|
||||||
if ($success === false) {
|
if ($success === false) {
|
||||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||||
parent::deleteCacheData($cellID);
|
parent::deleteCacheData($cellID);
|
||||||
throw new \PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in Wincache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in Wincache');
|
||||||
}
|
}
|
||||||
if (!wincache_ucache_add($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
|
if (!wincache_ucache_add($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
|
||||||
$this->__destruct();
|
$this->__destruct();
|
||||||
throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in Wincache');
|
throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in Wincache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,10 +240,10 @@ class Wincache extends CacheBase implements ICache
|
||||||
/**
|
/**
|
||||||
* Initialise this new cell collection
|
* Initialise this new cell collection
|
||||||
*
|
*
|
||||||
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
|
||||||
* @param mixed[] $arguments Additional initialisation arguments
|
* @param mixed[] $arguments Additional initialisation arguments
|
||||||
*/
|
*/
|
||||||
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
|
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
|
||||||
{
|
{
|
||||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet;
|
namespace PhpOffice\PhpSpreadsheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -148,7 +148,7 @@ class CachedObjectStorageFactory
|
||||||
{
|
{
|
||||||
$activeMethods = [];
|
$activeMethods = [];
|
||||||
foreach (self::$storageMethods as $storageMethod) {
|
foreach (self::$storageMethods as $storageMethod) {
|
||||||
$cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $storageMethod;
|
$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $storageMethod;
|
||||||
if (call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) {
|
if (call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) {
|
||||||
$activeMethods[] = $storageMethod;
|
$activeMethods[] = $storageMethod;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ class CachedObjectStorageFactory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
|
$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
|
||||||
if (!call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) {
|
if (!call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ class CachedObjectStorageFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::$cacheStorageMethod === null) {
|
if (self::$cacheStorageMethod === null) {
|
||||||
self::$cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
|
self::$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
|
||||||
self::$cacheStorageMethod = $method;
|
self::$cacheStorageMethod = $method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CalcEngine;
|
namespace PhpOffice\PhpSpreadsheet\CalcEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\CalcEngine;
|
namespace PhpOffice\PhpSpreadsheet\CalcEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Calculation;
|
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Calculation;
|
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -114,12 +114,12 @@ class Database
|
||||||
$k = array_search($criteriaName, $fieldNames);
|
$k = array_search($criteriaName, $fieldNames);
|
||||||
if (isset($dataValues[$k])) {
|
if (isset($dataValues[$k])) {
|
||||||
$dataValue = $dataValues[$k];
|
$dataValue = $dataValues[$k];
|
||||||
$dataValue = (is_string($dataValue)) ? \PhpSpreadsheet\Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
|
$dataValue = (is_string($dataValue)) ? \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
|
||||||
$testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
|
$testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// evaluate the criteria against the row data
|
// evaluate the criteria against the row data
|
||||||
$result = \PhpSpreadsheet\Calculation::getInstance()->_calculateFormulaValue('=' . $testConditionList);
|
$result = \PhpOffice\PhpSpreadsheet\Calculation::getInstance()->_calculateFormulaValue('=' . $testConditionList);
|
||||||
// If the row failed to meet the criteria, remove it from the database
|
// If the row failed to meet the criteria, remove it from the database
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
unset($database[$dataRow]);
|
unset($database[$dataRow]);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Calculation;
|
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||||
|
@ -87,7 +87,7 @@ class DateTime
|
||||||
return Functions::VALUE();
|
return Functions::VALUE();
|
||||||
}
|
}
|
||||||
if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
|
if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
|
||||||
$dateValue = \PhpSpreadsheet\Shared\Date::PHPToExcel($dateValue);
|
$dateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateValue);
|
||||||
} else {
|
} else {
|
||||||
$saveReturnDateType = Functions::getReturnDateType();
|
$saveReturnDateType = Functions::getReturnDateType();
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
|
@ -118,7 +118,7 @@ class DateTime
|
||||||
private static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0)
|
private static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0)
|
||||||
{
|
{
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
||||||
$oMonth = (int) $PHPDateObject->format('m');
|
$oMonth = (int) $PHPDateObject->format('m');
|
||||||
$oYear = (int) $PHPDateObject->format('Y');
|
$oYear = (int) $PHPDateObject->format('Y');
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class DateTime
|
||||||
$retValue = false;
|
$retValue = false;
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
$retValue = (float) \PhpSpreadsheet\Shared\Date::PHPToExcel(time());
|
$retValue = (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time());
|
||||||
break;
|
break;
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
$retValue = (integer) time();
|
$retValue = (integer) time();
|
||||||
|
@ -204,16 +204,16 @@ class DateTime
|
||||||
$saveTimeZone = date_default_timezone_get();
|
$saveTimeZone = date_default_timezone_get();
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
$retValue = false;
|
$retValue = false;
|
||||||
$excelDateTime = floor(\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
|
$excelDateTime = floor(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
$retValue = (float) $excelDateTime;
|
$retValue = (float) $excelDateTime;
|
||||||
break;
|
break;
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
$retValue = (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime);
|
$retValue = (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime);
|
||||||
break;
|
break;
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
$retValue = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateTime);
|
$retValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
date_default_timezone_set($saveTimeZone);
|
date_default_timezone_set($saveTimeZone);
|
||||||
|
@ -277,16 +277,16 @@ class DateTime
|
||||||
$day = Functions::flattenSingleValue($day);
|
$day = Functions::flattenSingleValue($day);
|
||||||
|
|
||||||
if (($month !== null) && (!is_numeric($month))) {
|
if (($month !== null) && (!is_numeric($month))) {
|
||||||
$month = \PhpSpreadsheet\Shared\Date::monthStringToNumber($month);
|
$month = \PhpOffice\PhpSpreadsheet\Shared\Date::monthStringToNumber($month);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($day !== null) && (!is_numeric($day))) {
|
if (($day !== null) && (!is_numeric($day))) {
|
||||||
$day = \PhpSpreadsheet\Shared\Date::dayStringToNumber($day);
|
$day = \PhpOffice\PhpSpreadsheet\Shared\Date::dayStringToNumber($day);
|
||||||
}
|
}
|
||||||
|
|
||||||
$year = ($year !== null) ? \PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($year) : 0;
|
$year = ($year !== null) ? \PhpOffice\PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($year) : 0;
|
||||||
$month = ($month !== null) ? \PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($month) : 0;
|
$month = ($month !== null) ? \PhpOffice\PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($month) : 0;
|
||||||
$day = ($day !== null) ? \PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($day) : 0;
|
$day = ($day !== null) ? \PhpOffice\PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($day) : 0;
|
||||||
if ((!is_numeric($year)) ||
|
if ((!is_numeric($year)) ||
|
||||||
(!is_numeric($month)) ||
|
(!is_numeric($month)) ||
|
||||||
(!is_numeric($day))) {
|
(!is_numeric($day))) {
|
||||||
|
@ -296,7 +296,7 @@ class DateTime
|
||||||
$month = (integer) $month;
|
$month = (integer) $month;
|
||||||
$day = (integer) $day;
|
$day = (integer) $day;
|
||||||
|
|
||||||
$baseYear = \PhpSpreadsheet\Shared\Date::getExcelCalendar();
|
$baseYear = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
|
||||||
// Validate parameters
|
// Validate parameters
|
||||||
if ($year < ($baseYear - 1900)) {
|
if ($year < ($baseYear - 1900)) {
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
|
@ -326,14 +326,14 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$excelDateValue = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day);
|
$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day);
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
return (float) $excelDateValue;
|
return (float) $excelDateValue;
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
return \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateValue);
|
return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,14 +417,14 @@ class DateTime
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
$date = 0;
|
$date = 0;
|
||||||
$calendar = \PhpSpreadsheet\Shared\Date::getExcelCalendar();
|
$calendar = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
|
||||||
if ($calendar != \PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900) {
|
if ($calendar != \PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900) {
|
||||||
$date = 1;
|
$date = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (float) \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
|
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
|
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
$dayAdjust = 0;
|
$dayAdjust = 0;
|
||||||
if ($hour < 0) {
|
if ($hour < 0) {
|
||||||
|
@ -559,7 +559,7 @@ class DateTime
|
||||||
return Functions::VALUE();
|
return Functions::VALUE();
|
||||||
}
|
}
|
||||||
$excelDateValue = floor(
|
$excelDateValue = floor(
|
||||||
\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
||||||
$PHPDateArray['year'],
|
$PHPDateArray['year'],
|
||||||
$PHPDateArray['month'],
|
$PHPDateArray['month'],
|
||||||
$PHPDateArray['day'],
|
$PHPDateArray['day'],
|
||||||
|
@ -572,7 +572,7 @@ class DateTime
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
return (float) $excelDateValue;
|
return (float) $excelDateValue;
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00');
|
return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00');
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ class DateTime
|
||||||
$PHPDateArray = date_parse($timeValue);
|
$PHPDateArray = date_parse($timeValue);
|
||||||
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
|
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
|
||||||
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
|
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
|
||||||
$excelDateValue = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
|
||||||
$PHPDateArray['year'],
|
$PHPDateArray['year'],
|
||||||
$PHPDateArray['month'],
|
$PHPDateArray['month'],
|
||||||
$PHPDateArray['day'],
|
$PHPDateArray['day'],
|
||||||
|
@ -625,14 +625,14 @@ class DateTime
|
||||||
$PHPDateArray['second']
|
$PHPDateArray['second']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$excelDateValue = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
|
$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
return (float) $excelDateValue;
|
return (float) $excelDateValue;
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) $phpDateValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600;
|
return (integer) $phpDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600;
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']);
|
return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']);
|
||||||
}
|
}
|
||||||
|
@ -672,12 +672,12 @@ class DateTime
|
||||||
// Execute function
|
// Execute function
|
||||||
$difference = $endDate - $startDate;
|
$difference = $endDate - $startDate;
|
||||||
|
|
||||||
$PHPStartDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
|
$PHPStartDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
|
||||||
$startDays = $PHPStartDateObject->format('j');
|
$startDays = $PHPStartDateObject->format('j');
|
||||||
$startMonths = $PHPStartDateObject->format('n');
|
$startMonths = $PHPStartDateObject->format('n');
|
||||||
$startYears = $PHPStartDateObject->format('Y');
|
$startYears = $PHPStartDateObject->format('Y');
|
||||||
|
|
||||||
$PHPEndDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
$PHPEndDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
||||||
$endDays = $PHPEndDateObject->format('j');
|
$endDays = $PHPEndDateObject->format('j');
|
||||||
$endMonths = $PHPEndDateObject->format('n');
|
$endMonths = $PHPEndDateObject->format('n');
|
||||||
$endYears = $PHPEndDateObject->format('Y');
|
$endYears = $PHPEndDateObject->format('Y');
|
||||||
|
@ -791,12 +791,12 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPStartDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
|
$PHPStartDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
|
||||||
$startDay = $PHPStartDateObject->format('j');
|
$startDay = $PHPStartDateObject->format('j');
|
||||||
$startMonth = $PHPStartDateObject->format('n');
|
$startMonth = $PHPStartDateObject->format('n');
|
||||||
$startYear = $PHPStartDateObject->format('Y');
|
$startYear = $PHPStartDateObject->format('Y');
|
||||||
|
|
||||||
$PHPEndDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
$PHPEndDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
||||||
$endDay = $PHPEndDateObject->format('j');
|
$endDay = $PHPEndDateObject->format('j');
|
||||||
$endMonth = $PHPEndDateObject->format('n');
|
$endMonth = $PHPEndDateObject->format('n');
|
||||||
$endYear = $PHPEndDateObject->format('Y');
|
$endYear = $PHPEndDateObject->format('Y');
|
||||||
|
@ -1087,9 +1087,9 @@ class DateTime
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
return (float) $endDate;
|
return (float) $endDate;
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($endDate);
|
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($endDate);
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
return \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,7 +1121,7 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
||||||
|
|
||||||
return (int) $PHPDateObject->format('j');
|
return (int) $PHPDateObject->format('j');
|
||||||
}
|
}
|
||||||
|
@ -1164,7 +1164,7 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
||||||
$DoW = $PHPDateObject->format('w');
|
$DoW = $PHPDateObject->format('w');
|
||||||
|
|
||||||
$firstDay = 1;
|
$firstDay = 1;
|
||||||
|
@ -1239,7 +1239,7 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
||||||
$dayOfYear = $PHPDateObject->format('z');
|
$dayOfYear = $PHPDateObject->format('z');
|
||||||
$PHPDateObject->modify('-' . $dayOfYear . ' days');
|
$PHPDateObject->modify('-' . $dayOfYear . ' days');
|
||||||
$dow = $PHPDateObject->format('w');
|
$dow = $PHPDateObject->format('w');
|
||||||
|
@ -1277,7 +1277,7 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
||||||
|
|
||||||
return (int) $PHPDateObject->format('n');
|
return (int) $PHPDateObject->format('n');
|
||||||
}
|
}
|
||||||
|
@ -1308,7 +1308,7 @@ class DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
|
||||||
|
|
||||||
return (int) $PHPDateObject->format('Y');
|
return (int) $PHPDateObject->format('Y');
|
||||||
}
|
}
|
||||||
|
@ -1348,7 +1348,7 @@ class DateTime
|
||||||
} elseif ($timeValue < 0.0) {
|
} elseif ($timeValue < 0.0) {
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
$timeValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
|
$timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
|
||||||
|
|
||||||
return (int) gmdate('G', $timeValue);
|
return (int) gmdate('G', $timeValue);
|
||||||
}
|
}
|
||||||
|
@ -1388,7 +1388,7 @@ class DateTime
|
||||||
} elseif ($timeValue < 0.0) {
|
} elseif ($timeValue < 0.0) {
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
$timeValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
|
$timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
|
||||||
|
|
||||||
return (int) gmdate('i', $timeValue);
|
return (int) gmdate('i', $timeValue);
|
||||||
}
|
}
|
||||||
|
@ -1428,7 +1428,7 @@ class DateTime
|
||||||
} elseif ($timeValue < 0.0) {
|
} elseif ($timeValue < 0.0) {
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
$timeValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
|
$timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
|
||||||
|
|
||||||
return (int) gmdate('s', $timeValue);
|
return (int) gmdate('s', $timeValue);
|
||||||
}
|
}
|
||||||
|
@ -1471,9 +1471,9 @@ class DateTime
|
||||||
|
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
return (float) \PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
|
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
return $PHPDateObject;
|
return $PHPDateObject;
|
||||||
}
|
}
|
||||||
|
@ -1519,9 +1519,9 @@ class DateTime
|
||||||
|
|
||||||
switch (Functions::getReturnDateType()) {
|
switch (Functions::getReturnDateType()) {
|
||||||
case Functions::RETURNDATE_EXCEL:
|
case Functions::RETURNDATE_EXCEL:
|
||||||
return (float) \PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
|
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
|
||||||
case Functions::RETURNDATE_PHP_NUMERIC:
|
case Functions::RETURNDATE_PHP_NUMERIC:
|
||||||
return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject));
|
||||||
case Functions::RETURNDATE_PHP_OBJECT:
|
case Functions::RETURNDATE_PHP_OBJECT:
|
||||||
return $PHPDateObject;
|
return $PHPDateObject;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue