Introduce vendor prefix `PhpOffice` to namespace

This commit is contained in:
Adrien Crivelli 2016-09-01 02:18:12 +09:00
parent 2922a13764
commit 47cde0dadc
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
337 changed files with 4129 additions and 4140 deletions

View File

@ -45,12 +45,12 @@
},
"autoload": {
"psr-4": {
"PhpSpreadsheet\\": "src/PhpSpreadsheet"
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"autoload-dev": {
"psr-4": {
"PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests"
"PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests"
}
}
}

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -44,7 +44,7 @@ $spreadsheet->setActiveSheetIndex(0);
$helper->log('Write to Excel2007 format');
// 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
$helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx']);

View File

@ -2,7 +2,7 @@
require_once __DIR__ . '/../src/Bootstrap.php';
$helper = new \PhpSpreadsheet\Helper\Sample();
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
if ($helper->isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@ -10,7 +10,7 @@ if ($helper->isCli()) {
}
// Create new Spreadsheet object
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$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('Pragma: public'); // HTTP/1.0
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'OpenDocument');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'OpenDocument');
$writer->save('php://output');
exit;

View File

@ -2,7 +2,7 @@
require_once __DIR__ . '/../src/Bootstrap.php';
$helper = new \PhpSpreadsheet\Helper\Sample();
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
if ($helper->isCli()) {
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
// and its directory location on your server
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
$rendererLibrary = 'mPDF5.4';
//$rendererLibrary = 'domPDF0.6.0beta3';
$rendererLibraryPath = __DIR__ . '/../../../libraries/PDF/' . $rendererLibrary;
// Create new Spreadsheet object
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$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
$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');
return;
@ -61,6 +61,6 @@ header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="01simple.pdf"');
header('Cache-Control: max-age=0');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
$writer->save('php://output');
exit;

View File

@ -2,7 +2,7 @@
require_once __DIR__ . '/../src/Bootstrap.php';
$helper = new \PhpSpreadsheet\Helper\Sample();
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
if ($helper->isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@ -10,7 +10,7 @@ if ($helper->isCli()) {
}
// Create new Spreadsheet object
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$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('Pragma: public'); // HTTP/1.0
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$writer->save('php://output');
exit;

View File

@ -2,14 +2,14 @@
require_once __DIR__ . '/../src/Bootstrap.php';
$helper = new \PhpSpreadsheet\Helper\Sample();
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
if ($helper->isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
return;
}
// Create new Spreadsheet object
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$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('Pragma: public'); // HTTP/1.0
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->save('php://output');
exit;

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -70,41 +70,41 @@ $dateTimeNow = time();
$spreadsheet->getActiveSheet()
->setCellValue('A9', 'Date/Time')
->setCellValue('B9', 'Date')
->setCellValue('C9', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
->setCellValue('C9', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C9')
->getNumberFormat()
->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
$spreadsheet->getActiveSheet()
->setCellValue('A10', 'Date/Time')
->setCellValue('B10', 'Time')
->setCellValue('C10', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
->setCellValue('C10', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C10')
->getNumberFormat()
->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4);
->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4);
$spreadsheet->getActiveSheet()
->setCellValue('A11', 'Date/Time')
->setCellValue('B11', 'Date and Time')
->setCellValue('C11', \PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
->setCellValue('C11', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C11')
->getNumberFormat()
->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
$spreadsheet->getActiveSheet()
->setCellValue('A12', 'NULL')
->setCellValue('C12', null);
$richText = new \PhpSpreadsheet\RichText();
$richText = new \PhpOffice\PhpSpreadsheet\RichText();
$richText->createText('你好 ');
$payable = $richText->createTextRun('你 好 吗?');
$payable->getFont()->setBold(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.');
@ -112,11 +112,11 @@ $spreadsheet->getActiveSheet()
->setCellValue('A13', 'Rich Text')
->setCellValue('C13', $richText);
$richText2 = new \PhpSpreadsheet\RichText();
$richText2 = new \PhpOffice\PhpSpreadsheet\RichText();
$richText2->createText("black text\n");
$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()
->getCell('C14')

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -34,22 +34,22 @@ $spreadsheet->getActiveSheet()
// 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->setPath(__DIR__ . '/images/PhpSpreadsheet_logo.gif');
$drawing->setHeight(36);
$spreadsheet->getActiveSheet()
->getHeaderFooter()
->addImage($drawing, \PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
->addImage($drawing, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
// Set page orientation and size
$helper->log('Set page orientation and size');
$spreadsheet->getActiveSheet()
->getPageSetup()
->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()
->getPageSetup()
->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename worksheet
$helper->log('Rename worksheet');

View File

@ -2,8 +2,8 @@
require __DIR__ . '/Header.php';
$cacheMethod = \PhpSpreadsheet\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP;
if (\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
$cacheMethod = \PhpOffice\PhpSpreadsheet\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP;
if (\PhpOffice\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
} else {
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');

View File

@ -2,8 +2,8 @@
require __DIR__ . '/Header.php';
$cacheMethod = \PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE;
if (\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
$cacheMethod = \PhpOffice\PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE;
if (\PhpOffice\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
} else {
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');

View File

@ -2,8 +2,8 @@
require __DIR__ . '/Header.php';
$cacheMethod = \PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE3;
if (\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
$cacheMethod = \PhpOffice\PhpSpreadsheet\CachedObjectStorageFactory::CACHE_TO_SQLITE3;
if (\PhpOffice\PhpSpreadsheet\Settings::setCacheStorageMethod($cacheMethod)) {
$helper->log('Enable Cell Caching using ' . $cacheMethod . ' method');
} else {
$helper->log('ERROR: Unable to set Cell Caching using ' . $cacheMethod . ' method, reverting to memory');

View File

@ -5,11 +5,11 @@ require __DIR__ . '/Header.php';
// Create temporary file that will be read
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$filename = $helper->getTemporaryFilename();
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer->save($filename);
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('Excel2007', $filename, $callStartTime);
// Save

View File

@ -5,14 +5,14 @@ require __DIR__ . '/Header.php';
// Create temporary file that will be read
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$filename = $helper->getTemporaryFilename();
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer->save($filename);
// 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);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('Excel2007', $filename, $callStartTime);
$callEndTime = microtime(true);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -47,30 +47,30 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12);
// Add conditional formatting
$helper->log('Add conditional formatting');
$conditional1 = new \PhpSpreadsheet\Style\Conditional();
$conditional1->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_BETWEEN)
$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_BETWEEN)
->addCondition('200')
->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()->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->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
$conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
$conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
->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()->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->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
->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()->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();
array_push($conditionalStyles, $conditional1);
@ -98,8 +98,8 @@ $spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spread
// Set page orientation and size
$helper->log('Set page orientation and size');
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename worksheet
$helper->log('Rename worksheet');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -32,22 +32,22 @@ $spreadsheet->getActiveSheet()
$spreadsheet->getActiveSheet()->getStyle('A1:A8')
->getNumberFormat()
->setFormatCode(
\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00
\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00
);
// Add conditional formatting
$helper->log('Add conditional formatting');
$conditional1 = new \PhpSpreadsheet\Style\Conditional();
$conditional1->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
->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->setConditionType(\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
->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();
array_push($conditionalStyles, $conditional1);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -36,7 +36,7 @@ for ($i = 2; $i <= 50; ++$i) {
// Add page breaks every 10 rows
if ($i % 10 == 0) {
// Add a page break
$spreadsheet->getActiveSheet()->setBreak('A' . $i, \PhpSpreadsheet\Worksheet::BREAK_ROW);
$spreadsheet->getActiveSheet()->setBreak('A' . $i, \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_ROW);
}
}

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -48,7 +48,7 @@ foreach ($years as $year) {
foreach ($countries as $country) {
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
for ($i = 1; $i <= $endDays; ++$i) {
$eDate = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$year,
$period,
$i
@ -86,8 +86,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.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('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$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)
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
$autoFilter->getColumn('C')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'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
// We us a dateGroup ruletype for this, although it is still a standard filter
foreach ($periods as $period) {
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
$autoFilter->getColumn('D')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
[
'year' => $currentYear,
'month' => $period,
'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
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -48,7 +48,7 @@ foreach ($years as $year) {
foreach ($countries as $country) {
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
for ($i = 1; $i <= $endDays; ++$i) {
$eDate = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$year,
$period,
$i
@ -86,8 +86,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.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('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@ -104,39 +104,39 @@ $helper->log('Set active filters');
// Filter the Country column on a filter value of Germany
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
$autoFilter->getColumn('C')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'Germany'
);
// Filter the Date column on a filter value of the year to date
$autoFilter->getColumn('D')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
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
$autoFilter->getColumn('E')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
400
)
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('E')
->setJoin(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
->setJoin(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
600
)
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
// Save
$helper->write($spreadsheet, __FILE__);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -48,7 +48,7 @@ foreach ($years as $year) {
foreach ($countries as $country) {
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
for ($i = 1; $i <= $endDays; ++$i) {
$eDate = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$year,
$period,
$i
@ -86,8 +86,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.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('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$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)
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
$autoFilter->getColumn('C')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
->setRuleType(\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'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
// We us a dateGroup ruletype for this, although it is still a standard filter
foreach ($periods as $period) {
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
$autoFilter->getColumn('D')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
[
'year' => $currentYear,
'month' => $period,
'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
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
->setFilterType(\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -37,7 +37,7 @@ $spreadsheet->getActiveSheet()->getProtection()->setSheet(true);
$spreadsheet->getActiveSheet()
->getStyle('A2:B2')
->getProtection()->setLocked(
\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED
\PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED
);
// Save

View File

@ -6,12 +6,12 @@ require __DIR__ . '/Header.php';
// List functions
$helper->log('List implemented functions');
$calc = \PhpSpreadsheet\Calculation::getInstance();
$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
print_r($calc->listFunctionNames());
// 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
$helper->log('Add some data and formulas');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// 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
$helper->log('Add some data and formulas');
@ -13,7 +13,7 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', '=B1')
->setCellValue('B1', '=A1+1')
->setCellValue('B2', '=A2');
\PhpSpreadsheet\Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
\PhpOffice\PhpSpreadsheet\Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
// Calculated data
$helper->log('Calculated data');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$filename = $helper->getFilename(__FILE__, 'xls');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// 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
$helper->log('Set data validation');
$validation = $spreadsheet->getActiveSheet()->getCell('B3')->getDataValidation();
$validation->setType(\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE);
$validation->setErrorStyle(\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE);
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
$validation->setAllowBlank(true);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
@ -48,8 +48,8 @@ $validation->setFormula1(10);
$validation->setFormula2(20);
$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation();
$validation->setType(\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation->setErrorStyle(\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(false);
$validation->setShowInputMessage(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 = $spreadsheet->getActiveSheet()->getCell('B7')->getDataValidation();
$validation->setType(\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation->setErrorStyle(\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(false);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$helper->log('Write to CSV format');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV')->setDelimiter(',')
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
@ -15,7 +15,7 @@ $helper->logWrite($writer, $filename, $callStartTime);
$helper->log('Read from CSV format');
$reader = \PhpSpreadsheet\IOFactory::createReader('CSV')->setDelimiter(',')
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('CSV')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
@ -28,7 +28,7 @@ $helper->write($spreadsheetFromCSV, __FILE__, ['Excel2007' => 'xlsx']);
// Write CSV
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
$writerCSV = \PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'CSV');
$writerCSV = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'CSV');
$writerCSV->setExcelCompatibility(true);
$callStartTime = microtime(true);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$filename = $helper->getFilename(__FILE__, 'html');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,16 +1,16 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
// List functions
$helper->log('List implemented functions');
$calc = \PhpSpreadsheet\Calculation::getInstance();
$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
print_r($calc->listFunctionNames());
// 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
$helper->log('Add some data');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -28,8 +28,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:')
// Define named ranges
$helper->log('Define named ranges');
$spreadsheet->addNamedRange(new \PhpSpreadsheet\NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
$spreadsheet->addNamedRange(new \PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
// Rename named ranges
$helper->log('Rename named ranges');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$filename = __DIR__ . '/templates/Excel2003XMLTest.xml';
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('Excel2003XML', $filename, $callStartTime);
// Save

View File

@ -6,14 +6,14 @@ $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
// Write temporary file
$filename = $helper->getTemporaryFilename('xls');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
// Read Excel5 file
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('Excel5', $filename, $callStartTime);
// Save

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$filename = __DIR__ . '/templates/GnumericTest.gnumeric';
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('Gnumeric', $filename, $callStartTime);
// Save

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$filename = __DIR__ . '/templates/OOCalcTest.ods';
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('OOCalc', $filename, $callStartTime);
// Save

View File

@ -3,11 +3,11 @@
require __DIR__ . '/Header.php';
// 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';
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('OOCalc', $filename, $callStartTime);
// Save

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
$filename = __DIR__ . '/templates/SylkTest.slk';
$callStartTime = microtime(true);
$spreadsheet = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
$helper->logRead('SYLK', $filename, $callStartTime);
// Save

View File

@ -5,9 +5,9 @@ $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
// Change these values to select the Rendering library that you wish to use
// and its directory location on your server
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
//$rendererLibrary = 'mPDF5.4';
$rendererLibrary = 'domPDF0.6.0beta3';
@ -17,11 +17,11 @@ $helper->log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$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}");
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');
}

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -22,19 +22,19 @@ $spreadsheet->setActiveSheetIndex(0);
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
['fill' => [
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'],
],
'borders' => [
'bottom' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_THIN],
'right' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
],
]
);
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
['fill' => [
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'],
],
]

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -20,29 +20,29 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
$helper->log('Add some data');
$spreadsheet->setActiveSheetIndex(0);
$sharedStyle1 = new \PhpSpreadsheet\Style();
$sharedStyle2 = new \PhpSpreadsheet\Style();
$sharedStyle1 = new \PhpOffice\PhpSpreadsheet\Style();
$sharedStyle2 = new \PhpOffice\PhpSpreadsheet\Style();
$sharedStyle1->applyFromArray(
['fill' => [
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'],
],
'borders' => [
'bottom' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_THIN],
'right' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
],
]
);
$sharedStyle2->applyFromArray(
['fill' => [
'type' => \PhpSpreadsheet\Style\Fill::FILL_SOLID,
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'],
],
'borders' => [
'bottom' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_THIN],
'right' => ['style' => \PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
],
]
);

View File

@ -1,18 +1,18 @@
<?php
namespace PhpSpreadsheet;
namespace PhpOffice\PhpSpreadsheet;
require __DIR__ . '/Header.php';
// Write temporary file
$largeSpreadsheet = require __DIR__ . '/templates/largeSpreadsheet.php';
$writer = new \PhpSpreadsheet\Writer\Excel2007($largeSpreadsheet);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($largeSpreadsheet);
$filename = $helper->getTemporaryFilename();
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
class MyReadFilter implements \PhpSpreadsheet\Reader\IReadFilter
class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
{
public function readCell($column, $row, $worksheetName = '')
{
@ -26,7 +26,7 @@ class MyReadFilter implements \PhpSpreadsheet\Reader\IReadFilter
}
$helper->log('Load from Excel2007 file');
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
$reader->setReadFilter(new MyReadFilter());
$callStartTime = microtime(true);
$spreadsheet = $reader->load($filename);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// 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
$helper->log('Add a drawing to the worksheet');
$drawing = new \PhpSpreadsheet\Worksheet\MemoryDrawing();
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing();
$drawing->setName('Sample image');
$drawing->setDescription('Sample image');
$drawing->setImageResource($gdImage);
$drawing->setRenderingFunction(\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG);
$drawing->setMimeType(\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
$drawing->setRenderingFunction(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG);
$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
$drawing->setHeight(36);
$drawing->setWorksheet($spreadsheet->getActiveSheet());

View File

@ -4,9 +4,9 @@ require __DIR__ . '/Header.php';
// Change these values to select the PDF Rendering library that you wish to use
// and its directory location on your server
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
//$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
$rendererName = \PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
//$rendererLibrary = 'mPDF5.4';
$rendererLibrary = 'domPDF0.6.0beta3';
@ -14,7 +14,7 @@ $rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
// Read from Excel2007 (.xlsx) template
$helper->log('Load Excel2007 template file');
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
$spreadsheet = $reader->load(__DIR__ . '/templates/26template.xlsx');
/* 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)
$helper->log('Write to PDF format');
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');
} else {
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
@ -39,7 +39,7 @@ $worksheet->removeRow(1, 2);
// Export to CSV (.csv)
$helper->log('Write to CSV format');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV');
$filename = $helper->getFilename(__FILE__, 'csv');
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Read from Excel5 (.xls) template
$helper->log('Load Excel2007 template file');
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel5');
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5');
$spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls');
// Save

View File

@ -4,13 +4,13 @@ require __DIR__ . '/Header.php';
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$filename = $helper->getTemporaryFilename();
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
$callStartTime = microtime(true);
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
$spreadsheet = $reader->load($filename);
$helper->logRead('Excel2007', $filename, $callStartTime);
$helper->log('Iterate worksheets');

View File

@ -1,6 +1,6 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
// Set timezone
@ -9,11 +9,11 @@ date_default_timezone_set('UTC');
// 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
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');

View File

@ -3,7 +3,7 @@
require __DIR__ . '/Header.php';
$helper->log('Load from Excel5 template');
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel5');
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5');
$spreadsheet = $reader->load(__DIR__ . '/templates/30template.xls');
$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;
foreach ($data as $r => $dataRow) {

View File

@ -5,7 +5,7 @@ require __DIR__ . '/Header.php';
$inputFileType = 'Excel2007';
$inputFileName = __DIR__ . '/templates/31docproperties.xlsx';
$spreadsheetReader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$spreadsheetReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$callStartTime = microtime(true);
$spreadsheet = $spreadsheetReader->load($inputFileName);
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
@ -18,7 +18,7 @@ $spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document')
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
@ -28,7 +28,7 @@ $helper->logEndingNotes();
// Reread File
$helper->log('Reread Excel2007 file');
$spreadsheetRead = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
// Set properties
$helper->log('Get properties');
@ -53,9 +53,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
foreach ($customProperties as $customProperty) {
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($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);
} elseif ($propertyType == \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
} elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
} else {
$formattedValue = $propertyValue;

View File

@ -5,7 +5,7 @@ require __DIR__ . '/Header.php';
$inputFileType = 'Excel5';
$inputFileName = __DIR__ . '/templates/31docproperties.xls';
$spreadsheetReader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$spreadsheetReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$callStartTime = microtime(true);
$spreadsheet = $spreadsheetReader->load($inputFileName);
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
@ -18,7 +18,7 @@ $spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document')
// Save Excel 95 file
$filename = $helper->getFilename(__FILE__, 'xls');
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
@ -28,7 +28,7 @@ $helper->logEndingNotes();
// Reread File
$helper->log('Reread Excel5 file');
$spreadsheetRead = \PhpSpreadsheet\IOFactory::load($filename);
$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
// Set properties
$helper->log('Get properties');
@ -53,9 +53,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
foreach ($customProperties as $customProperty) {
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($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);
} elseif ($propertyType == \PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
} elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
} else {
$formattedValue = $propertyValue;

View File

@ -20,7 +20,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log('File ' . $inputFileNameShort . ' does not exist');
continue;
}
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$callStartTime = microtime(true);
$spreadsheet = $reader->load($inputFileName);
@ -69,7 +69,7 @@ foreach ($inputFileNames as $inputFileName) {
}
$outputFileName = $helper->getFilename($inputFileName);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($outputFileName);

View File

@ -4,11 +4,11 @@ require __DIR__ . '/Header.php';
// Change these values to select the Rendering library that you wish to use
// 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/';
$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');
return;
@ -35,7 +35,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
@ -83,7 +83,7 @@ foreach ($inputFileNames as $inputFileName) {
// Save
$filename = $helper->getFilename($inputFileName);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -4,15 +4,15 @@ require __DIR__ . '/Header.php';
// Change these values to select the Rendering library that you wish to use
// for PDF files, and its directory location on your server
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
//$rendererName = PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
$rendererLibrary = 'mPDF5.4';
//$rendererLibrary = 'domPDF0.6.0beta3';
$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');
return;
@ -20,11 +20,11 @@ if (!PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath
// Change these values to select the Rendering library that you wish to use
// 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/';
$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');
return;
@ -51,7 +51,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
@ -99,7 +99,7 @@ foreach ($inputFileNames as $inputFileName) {
// Save
$filename = $helper->getFilename($inputFileName);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'PDF');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,9 +23,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -35,7 +35,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -45,15 +45,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -61,15 +61,15 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// 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
$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');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -89,7 +89,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,13 +1,13 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,9 +23,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -35,7 +35,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -45,15 +45,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -61,18 +61,18 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
// 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');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Chart');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -92,7 +92,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,9 +23,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -35,7 +35,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -45,15 +45,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -61,18 +61,18 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
// 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');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -92,7 +92,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -31,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 'Budget'
new \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!$C$1', null, 1), // 'Budget'
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 'Forecast'
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), // 'Actual'
];
// Set the X-Axis Labels
// Datatype
@ -43,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -53,15 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
new \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!$C$2:$C$13', null, 12),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', null, 12),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -69,19 +69,19 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
// 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');
$xAxisLabel = new \PhpSpreadsheet\Chart\Title('Financial Period');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Grouped Column Chart');
$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Financial Period');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -101,7 +101,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -31,13 +31,13 @@ $worksheet->fromArray(
// Data values
// Data Marker
$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 = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
];
$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
@ -48,7 +48,7 @@ $dataSeriesLabels3 = [
// Data values
// Data Marker
$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
@ -59,13 +59,13 @@ $xAxisTickValues = [
// Data values
// Data Marker
$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
$series1 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues, // plotCategory
@ -73,7 +73,7 @@ $series1 = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// 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
// Datatype
@ -83,13 +83,13 @@ $series1->setPlotDirection(\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
// Data values
// Data Marker
$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
$series2 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
null, // plotCategory
@ -104,13 +104,13 @@ $series2 = new \PhpSpreadsheet\Chart\DataSeries(
// Data values
// Data Marker
$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
$series3 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
$series3 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels3, // plotLabel
null, // plotCategory
@ -118,14 +118,14 @@ $series3 = new \PhpSpreadsheet\Chart\DataSeries(
);
// 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
$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
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -145,7 +145,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,9 +23,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -35,7 +35,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -45,15 +45,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -61,15 +61,15 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// 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
$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');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stacked Line Chart');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -89,7 +89,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,9 +23,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -35,7 +35,7 @@ $dataSeriesLabels1 = [
// Data values
// Data Marker
$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
// Datatype
@ -45,15 +45,15 @@ $xAxisTickValues1 = [
// Data values
// Data Marker
$dataSeriesValues1 = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series1 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues1, // plotCategory
@ -61,15 +61,15 @@ $series1 = new \PhpSpreadsheet\Chart\DataSeries(
);
// 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
$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');
$yAxisLabel1 = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
$yAxisLabel1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart1 = new \PhpSpreadsheet\Chart(
$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@ -95,9 +95,9 @@ $worksheet->addChart($chart1);
// Data values
// Data Marker
$dataSeriesLabels2 = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -107,7 +107,7 @@ $dataSeriesLabels2 = [
// Data values
// Data Marker
$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
// Datatype
@ -117,15 +117,15 @@ $xAxisTickValues2 = [
// Data values
// Data Marker
$dataSeriesValues2 = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series2 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
$xAxisTickValues2, // plotCategory
@ -133,18 +133,18 @@ $series2 = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea2 = new \PhpSpreadsheet\Chart\PlotArea(null, [$series2]);
$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series2]);
// 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');
$yAxisLabel2 = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
$yAxisLabel2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart2 = new \PhpSpreadsheet\Chart(
$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
'chart2', // name
$title2, // title
$legend2, // legend
@ -164,7 +164,7 @@ $worksheet->addChart($chart2);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,7 +23,7 @@ $worksheet->fromArray(
// Data values
// Data Marker
$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
// Datatype
@ -33,7 +33,7 @@ $dataSeriesLabels1 = [
// Data values
// Data Marker
$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
// Datatype
@ -43,12 +43,12 @@ $xAxisTickValues1 = [
// Data values
// Data Marker
$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
$series1 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
null, // plotGrouping (Pie charts don't have any grouping)
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
@ -57,19 +57,19 @@ $series1 = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set up a layout object for the Pie chart
$layout1 = new \PhpSpreadsheet\Chart\Layout();
$layout1 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
$layout1->setShowVal(true);
$layout1->setShowPercent(true);
// 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
$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
$chart1 = new \PhpSpreadsheet\Chart(
$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@ -95,7 +95,7 @@ $worksheet->addChart($chart1);
// Data values
// Data Marker
$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
// Datatype
@ -105,7 +105,7 @@ $dataSeriesLabels2 = [
// Data values
// Data Marker
$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
// Datatype
@ -115,12 +115,12 @@ $xAxisTickValues2 = [
// Data values
// Data Marker
$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
$series2 = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_DONUTCHART, // plotType
$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_DONUTCHART, // plotType
null, // plotGrouping (Donut charts don't have any grouping)
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
@ -129,17 +129,17 @@ $series2 = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set up a layout object for the Pie chart
$layout2 = new \PhpSpreadsheet\Chart\Layout();
$layout2 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
$layout2->setShowVal(true);
$layout2->setShowCatName(true);
// 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
$chart2 = new \PhpSpreadsheet\Chart(
$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
'chart2', // name
$title2, // title
null, // legend
@ -159,7 +159,7 @@ $worksheet->addChart($chart2);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -31,8 +31,8 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \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!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -42,8 +42,8 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
new \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
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
// Datatype
@ -53,13 +53,13 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \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!$C$2:$C$13', null, 12),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_RADARCHART, // plotType
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_RADARCHART, // plotType
null, // plotGrouping (Radar charts don't have any grouping)
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@ -67,21 +67,21 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
$dataSeriesValues, // plotValues
null, // plotDirection
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
$layout = new \PhpSpreadsheet\Chart\Layout();
$layout = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
// 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
$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
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -101,7 +101,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -23,13 +23,13 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
$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
// Datatype
@ -39,14 +39,14 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
null, // plotGrouping (Scatter charts don't have any grouping)
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@ -54,19 +54,19 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
$dataSeriesValues, // plotValues
null, // plotDirection
null, // smooth line
\PhpSpreadsheet\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
);
// 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
$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');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Scatter Chart');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -86,7 +86,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,9 +1,9 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -18,7 +18,7 @@ $worksheet->fromArray(
'A1',
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
// Datatype
@ -28,10 +28,10 @@ $worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PhpSpreadsheet\S
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), //Max / Open
new \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 \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), //Max Threshold / Max
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), //Max / Open
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), //Min / Close
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), //Min Threshold / Min
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), //Max Threshold / Max
];
// Set the X-Axis Labels
// Datatype
@ -41,7 +41,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -51,15 +51,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', null, 5),
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', null, 5),
new \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!$B$2:$B$6', null, 5),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', null, 5),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', null, 5),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', null, 5),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_STOCKCHART, // plotType
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_STOCKCHART, // plotType
null, // plotGrouping - if we set this to not null, then xlsx throws error
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@ -68,16 +68,16 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// 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
$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');
$xAxisLabel = new \PhpSpreadsheet\Chart\Title('Counts');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Values');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stock Chart');
$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Counts');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Values');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'stock-chart', // name
$title, // title
$legend, // legend
@ -97,7 +97,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -1,16 +1,16 @@
<?php
/** PhpSpreadsheet */
require __DIR__ . '/Header.php';
// Create temporary file that will be read
$sampleSpreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
$filename = $helper->getTemporaryFilename();
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer->save($filename);
$helper->log('Load from Excel2007 file');
$reader = \PhpSpreadsheet\IOFactory::createReader('Excel2007');
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($filename);
@ -29,7 +29,7 @@ $worksheet->fromArray(
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
$writer = \PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);

View File

@ -4,11 +4,11 @@ require __DIR__ . '/Header.php';
// Change these values to select the Rendering library that you wish to use
// 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/';
$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');
return;
@ -35,7 +35,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file ", $inputFileNameShort);
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -23,7 +23,7 @@ $spreadsheet->setActiveSheetIndex(0)
->setCellValue('B2', 'world!');
// 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
$helper->write($spreadsheet, __FILE__);

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -39,7 +39,7 @@ foreach ($continents as $key => $filename) {
$spreadsheet->getActiveSheet()
->fromArray($countries, null, $column . '1');
$spreadsheet->addNamedRange(
new PhpSpreadsheet\NamedRange(
new \PhpOffice\PhpSpreadsheet\NamedRange(
$continent,
$spreadsheet->getActiveSheet(),
$column . '1:' . $column . $countryCount
@ -61,7 +61,7 @@ $spreadsheet->getActiveSheet()
->setVisible(false);
$spreadsheet->addNamedRange(
new PhpSpreadsheet\NamedRange(
new \PhpOffice\PhpSpreadsheet\NamedRange(
'Continents',
$spreadsheet->getActiveSheet(),
$continentColumn . '1:' . $continentColumn . count($continents)
@ -85,8 +85,8 @@ $spreadsheet->getActiveSheet()
$validation = $spreadsheet->getActiveSheet()
->getCell('B1')
->getDataValidation();
$validation->setType(PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
->setErrorStyle(PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
@ -106,8 +106,8 @@ $spreadsheet->getActiveSheet()
$validation = $spreadsheet->getActiveSheet()
->getCell('B3')
->getDataValidation();
$validation->setType(PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
->setErrorStyle(PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)

View File

@ -3,13 +3,13 @@
require __DIR__ . '/Header.php';
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$helper->log('Create styles array');
$styles = [];
for ($i = 0; $i < 10; ++$i) {
$style = new \PhpSpreadsheet\Style();
$style = new \PhpOffice\PhpSpreadsheet\Style();
$style->getFont()->setSize($i + 4);
$styles[] = $style;
}
@ -20,7 +20,7 @@ for ($col = 0; $col < 50; ++$col) {
for ($row = 0; $row < 100; ++$row) {
$str = ($row + $col);
$style = $styles[$row % 10];
$coord = \PhpSpreadsheet\Cell::stringFromColumnIndex($col) . ($row + 1);
$coord = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col) . ($row + 1);
$worksheet->setCellValue($coord, $str);
$worksheet->duplicateStyle($style, $coord);
}

View File

@ -4,7 +4,7 @@ require __DIR__ . '/Header.php';
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// 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>';
$wizard = new \PhpSpreadsheet\Helper\HTML();
$wizard = new \PhpOffice\PhpSpreadsheet\Helper\HTML();
$richText = $wizard->toRichTextObject($html1);
$spreadsheet->getActiveSheet()

View File

@ -5,13 +5,13 @@ require __DIR__ . '/Header.php';
$helper->log('Load MergeBook1 from Excel2007 file');
$filename1 = __DIR__ . '/templates/43mergeBook1.xlsx';
$callStartTime = microtime(true);
$spreadsheet1 = \PhpSpreadsheet\IOFactory::load($filename1);
$spreadsheet1 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename1);
$helper->logRead('Excel2007', $filename1, $callStartTime);
$helper->log('Load MergeBook2 from Excel2007 file');
$filename2 = __DIR__ . '/templates/43mergeBook2.xlsx';
$callStartTime = microtime(true);
$spreadsheet2 = \PhpSpreadsheet\IOFactory::load($filename2);
$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename2);
$helper->logRead('Excel2007', $filename2, $callStartTime);
foreach ($spreadsheet2->getSheetNames() as $sheetName) {

View File

@ -5,11 +5,11 @@ require __DIR__ . '/Header.php';
// Create temporary file that will be read
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$filename = $helper->getTemporaryFilename();
$writer = new \PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
$writer->save($filename);
$inputFileType = \PhpSpreadsheet\IOFactory::identify($filename);
$reader = \PhpSpreadsheet\IOFactory::createReader($inputFileType);
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$sheetList = $reader->listWorksheetNames($filename);
$sheetInfo = $reader->listWorksheetInfo($filename);

View File

@ -6,7 +6,7 @@ error_reporting(E_ALL);
require_once __DIR__ . '/../src/Bootstrap.php';
$helper = new \PhpSpreadsheet\Helper\Sample();
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
if (!defined('EOL')) {
define('EOL', $helper->isCli() ? PHP_EOL : '<br />');
}

View File

@ -1,6 +1,6 @@
<?php
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->fromArray(
[
@ -20,9 +20,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
new \PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
new \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!$B$1', null, 1), // 2010
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@ -32,7 +32,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$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
// Datatype
@ -42,15 +42,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
new \PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
new \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!$B$2:$B$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
$series = new \PhpSpreadsheet\Chart\DataSeries(
\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
\PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -58,18 +58,18 @@ $series = new \PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new \PhpSpreadsheet\Chart\PlotArea(null, [$series]);
$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
// 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');
$yAxisLabel = new \PhpSpreadsheet\Chart\Title('Value ($k)');
$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Bar Chart');
$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
// Create the chart
$chart = new \PhpSpreadsheet\Chart(
$chart = new \PhpOffice\PhpSpreadsheet\Chart(
'chart1', // name
$title, // title
$legend, // legend

View File

@ -2,7 +2,7 @@
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set properties');

View File

@ -2,7 +2,7 @@
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
$spreadsheet = new \PhpSpreadsheet\Spreadsheet();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@ -18,8 +18,8 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
$helper->log('Add some data');
$spreadsheet->setActiveSheetIndex(0);
$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()->getStyle('D1')->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15);
$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(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15);
$spreadsheet->getActiveSheet()->setCellValue('E1', '#12566');
$spreadsheet->getActiveSheet()->setCellValue('A3', 'Product Id');
@ -81,13 +81,13 @@ $spreadsheet->getActiveSheet()->getComment('E13')->getFillColor()->setRGB('EEEEE
// Add rich-text string
$helper->log('Add rich-text string');
$richText = new \PhpSpreadsheet\RichText();
$richText = new \PhpOffice\PhpSpreadsheet\RichText();
$richText->createText('This invoice is ');
$payable = $richText->createTextRun('payable within thirty days after the end of the month');
$payable->getFont()->setBold(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.');
@ -105,7 +105,7 @@ $spreadsheet->getActiveSheet()->protectCells('A3:E13', 'PhpSpreadsheet');
// 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
$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()->setSize(20);
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(\PhpSpreadsheet\Style\Color::COLOR_WHITE);
$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
$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('E1')->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(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE);
$spreadsheet->getActiveSheet()->getStyle('D13')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
// Set alignments
$helper->log('Set alignments');
$spreadsheet->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
$spreadsheet->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
$spreadsheet->getActiveSheet()->getStyle('D13')->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(\PhpOffice\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()->setVertical(\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
$spreadsheet->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_JUSTIFY);
$spreadsheet->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
$spreadsheet->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true);
@ -143,7 +143,7 @@ $helper->log('Set thin black border outline around column');
$styleThinBlackBorderOutline = [
'borders' => [
'outline' => [
'style' => \PhpSpreadsheet\Style\Border::BORDER_THIN,
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => 'FF000000'],
],
],
@ -155,7 +155,7 @@ $helper->log('Set thick brown border outline around Total');
$styleThickBrownBorderOutline = [
'borders' => [
'outline' => [
'style' => \PhpSpreadsheet\Style\Border::BORDER_THICK,
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => 'FF993300'],
],
],
@ -164,7 +164,7 @@ $spreadsheet->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickB
// 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');
// Set style for header row using alternative method
@ -175,15 +175,15 @@ $spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
'bold' => true,
],
'alignment' => [
'horizontal' => \PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
],
'borders' => [
'top' => [
'style' => \PhpSpreadsheet\Style\Border::BORDER_THIN,
'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
],
],
'fill' => [
'type' => \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90,
'startcolor' => [
'argb' => 'FFA0A0A0',
@ -198,11 +198,11 @@ $spreadsheet->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray(
[
'alignment' => [
'horizontal' => \PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
],
'borders' => [
'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(
[
'alignment' => [
'horizontal' => \PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT,
],
]
);
@ -220,7 +220,7 @@ $spreadsheet->getActiveSheet()->getStyle('E3')->applyFromArray(
[
'borders' => [
'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
$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
$helper->log('Add a hyperlink to an external website');
$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
$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');
$spreadsheet->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
$spreadsheet->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
$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
$helper->log('Add a drawing to the worksheet');
$drawing = new \PhpSpreadsheet\Worksheet\Drawing();
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
$drawing->setName('Logo');
$drawing->setDescription('Logo');
$drawing->setPath(__DIR__ . '/../images/officelogo.jpg');
@ -254,7 +254,7 @@ $drawing->setWorksheet($spreadsheet->getActiveSheet());
// 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->setDescription('Paid');
$drawing->setPath(__DIR__ . '/../images/paid.png');
@ -267,7 +267,7 @@ $drawing->setWorksheet($spreadsheet->getActiveSheet());
// 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->setDescription('PhpSpreadsheet logo');
$drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.gif');
@ -290,8 +290,8 @@ $spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spread
// Set page orientation and size
$helper->log('Set page orientation and size');
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
// 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()->setSize(20);
$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);
// 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->setDescription('Terms and conditions');
$drawing->setPath(__DIR__ . '/../images/termsconditions.jpg');
@ -345,8 +345,8 @@ $drawing->setWorksheet($spreadsheet->getActiveSheet());
// Set page orientation and size
$helper->log('Set page orientation and size');
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename second worksheet
$helper->log('Rename second worksheet');

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet;
namespace PhpOffice\PhpSpreadsheet;
/**
* Autoloader for PhpSpreadsheet classes
@ -38,7 +38,7 @@ class Autoloader
spl_autoload_register('__autoload');
}
// 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)
{
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
return false;
}
$classFilePath = __DIR__ . DIRECTORY_SEPARATOR .
'PhpSpreadsheet' . DIRECTORY_SEPARATOR .
str_replace(['PhpSpreadsheet\\', '\\'], ['', '/'], $className) .
str_replace([$prefix, '\\'], ['', '/'], $className) .
'.php';
if ((file_exists($classFilePath) === false) || (is_readable($classFilePath) === false)) {

View File

@ -26,4 +26,4 @@
*/
include_once __DIR__ . '/Autoloader.php';
\PhpSpreadsheet\Autoloader::register();
\PhpOffice\PhpSpreadsheet\Autoloader::register();

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -57,7 +57,7 @@ class APC extends CacheBase implements ICache
$this->cacheTime
)) {
$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;
}
@ -68,11 +68,11 @@ class APC extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$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
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return bool
*/
public function isDataSet($pCoord)
@ -105,7 +105,7 @@ class APC extends CacheBase implements ICache
if ($success === false) {
// Entry no longer exists in APC, so clear it from the cache array
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;
@ -118,8 +118,8 @@ class APC extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -134,7 +134,7 @@ class APC extends CacheBase implements ICache
if ($obj === false) {
// Entry no longer exists in APC, so clear it from the cache array
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 {
// 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
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function deleteCacheData($pCoord)
{
@ -183,10 +183,10 @@ class APC extends CacheBase implements ICache
/**
* Clone the cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
parent::copyCellCollection($parent);
// Get a new id for the new file name
@ -199,11 +199,11 @@ class APC extends CacheBase implements ICache
if ($obj === false) {
// Entry no longer exists in APC, so clear it from the cache array
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)) {
$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
*
* @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
*/
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
{
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet
@ -29,14 +29,14 @@ abstract class CacheBase
/**
* Parent worksheet
*
* @var \PhpSpreadsheet\Worksheet
* @var \PhpOffice\PhpSpreadsheet\Worksheet
*/
protected $parent;
/**
* The currently active Cell
*
* @var \PhpSpreadsheet\Cell
* @var \PhpOffice\PhpSpreadsheet\Cell
*/
protected $currentObject = null;
@ -65,12 +65,12 @@ abstract class CacheBase
/**
* 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.
// 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
$this->parent = $parent;
}
@ -78,7 +78,7 @@ abstract class CacheBase
/**
* Return the parent worksheet for this cell collection
*
* @return \PhpSpreadsheet\Worksheet
* @return \PhpOffice\PhpSpreadsheet\Worksheet
*/
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
* @return bool
@ -124,11 +124,11 @@ abstract class CacheBase
/**
* Add or Update a cell in cache
*
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell
*/
public function updateCacheData(\PhpSpreadsheet\Cell $cell)
public function updateCacheData(\PhpOffice\PhpSpreadsheet\Cell $cell)
{
return $this->addCacheData($cell->getCoordinate(), $cell);
}
@ -137,7 +137,7 @@ abstract class CacheBase
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function deleteCacheData($pCoord)
{
@ -262,10 +262,10 @@ abstract class CacheBase
if ($r != $row) {
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
*
* @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->storeData();

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -73,11 +73,11 @@ class DiscISAM extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -94,8 +94,8 @@ class DiscISAM extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -138,9 +138,9 @@ class DiscISAM extends CacheBase implements ICache
/**
* 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);
// Get a new id for the new file name
@ -174,14 +174,14 @@ class DiscISAM extends CacheBase implements ICache
/**
* 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
*/
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
{
$this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
? $arguments['dir']
: \PhpSpreadsheet\Shared\File::sysGetTempDir();
: \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
parent::__construct($parent);
if (is_null($this->fileHandle)) {

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet
@ -30,27 +30,27 @@ interface ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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
*
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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
*
* @param string $pCoord Coordinate address of the cell to retrieve
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord);
@ -58,12 +58,12 @@ interface ICache
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
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
* @return bool
@ -87,9 +87,9 @@ interface ICache
/**
* 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

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -47,11 +47,11 @@ class Igbinary extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -68,8 +68,8 @@ class Igbinary extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
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->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
$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;
@ -74,11 +74,11 @@ class Memcache extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$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
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return bool
*/
public function isDataSet($pCoord)
@ -111,7 +111,7 @@ class Memcache extends CacheBase implements ICache
if ($success === false) {
// Entry no longer exists in Memcache, so clear it from the cache array
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;
@ -124,8 +124,8 @@ class Memcache extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -140,7 +140,7 @@ class Memcache extends CacheBase implements ICache
if ($obj === false) {
// Entry no longer exists in Memcache, so clear it from the cache array
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 {
// 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
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function deleteCacheData($pCoord)
{
@ -189,10 +189,10 @@ class Memcache extends CacheBase implements ICache
/**
* Clone the cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
parent::copyCellCollection($parent);
// Get a new id for the new file name
@ -205,11 +205,11 @@ class Memcache extends CacheBase implements ICache
if ($obj === false) {
// Entry no longer exists in Memcache, so clear it from the cache array
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)) {
$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
*
* @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
* @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';
$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
$this->memcache = new self();
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;
@ -268,11 +268,11 @@ class Memcache extends CacheBase implements ICache
*
* @param string $host Memcache server
* @param int $port Memcache port
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function failureCallback($host, $port)
{
throw new \PhpSpreadsheet\Exception("memcache {$host}:{$port} failed");
throw new \PhpOffice\PhpSpreadsheet\Exception("memcache {$host}:{$port} failed");
}
/**

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell
*/
public function addCacheData($pCoord, \PhpSpreadsheet\Cell $cell)
public function addCacheData($pCoord, \PhpOffice\PhpSpreadsheet\Cell $cell)
{
$this->cellCache[$pCoord] = $cell;
@ -55,8 +55,8 @@ class Memory extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -77,9 +77,9 @@ class Memory extends CacheBase implements ICache
/**
* 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);

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -47,11 +47,11 @@ class MemoryGZip extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -68,8 +68,8 @@ class MemoryGZip extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -47,11 +47,11 @@ class MemorySerialized extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -68,8 +68,8 @@ class MemorySerialized extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -66,11 +66,11 @@ class PHPTemp extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -87,8 +87,8 @@ class PHPTemp extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -131,9 +131,9 @@ class PHPTemp extends CacheBase implements ICache
/**
* 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);
// Open a new stream for the cell cache data
@ -167,10 +167,10 @@ class PHPTemp extends CacheBase implements ICache
/**
* 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
*/
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;

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -52,7 +52,7 @@ class SQLite extends CacheBase implements ICache
$this->currentObject->detach();
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;
}
@ -63,11 +63,11 @@ class SQLite extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -84,8 +84,8 @@ class SQLite extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -97,7 +97,7 @@ class SQLite extends CacheBase implements ICache
$query = 'SELECT value FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
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) {
// Return null if requested entry doesn't exist in cache
return null;
@ -119,7 +119,7 @@ class SQLite extends CacheBase implements ICache
* Is a value set for an indexed cell?
*
* @param string $pCoord Coordinate address of the cell to check
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return bool
*/
public function isDataSet($pCoord)
@ -132,7 +132,7 @@ class SQLite extends CacheBase implements ICache
$query = 'SELECT id FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
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) {
// Return null if requested entry doesn't exist in cache
return false;
@ -145,7 +145,7 @@ class SQLite extends CacheBase implements ICache
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function deleteCacheData($pCoord)
{
@ -157,7 +157,7 @@ class SQLite extends CacheBase implements ICache
// Check if the requested entry exists in the cache
$query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'";
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;
@ -168,7 +168,7 @@ class SQLite extends CacheBase implements ICache
*
* @param string $fromAddress Current 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
*/
public function moveCell($fromAddress, $toAddress)
@ -180,13 +180,13 @@ class SQLite extends CacheBase implements ICache
$query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $toAddress . "'";
$result = $this->DBHandle->exec($query);
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 . "'";
$result = $this->DBHandle->exec($query);
if ($result === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
return true;
@ -195,7 +195,7 @@ class SQLite extends CacheBase implements ICache
/**
* Get a list of all cell addresses currently held in cache
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return string[]
*/
public function getCellList()
@ -207,7 +207,7 @@ class SQLite extends CacheBase implements ICache
$query = 'SELECT id FROM kvp_' . $this->TableName;
$cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
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 = [];
@ -221,10 +221,10 @@ class SQLite extends CacheBase implements ICache
/**
* Clone the cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
$this->currentCellIsDirty;
$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)
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
@ -260,10 +260,10 @@ class SQLite extends CacheBase implements ICache
/**
* Initialise this new cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function __construct(\PhpSpreadsheet\Worksheet $parent)
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
parent::__construct($parent);
if (is_null($this->DBHandle)) {
@ -272,10 +272,10 @@ class SQLite extends CacheBase implements ICache
$this->DBHandle = new SQLiteDatabase($_DBName);
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)')) {
throw new \PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError()));
}
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function storeData()
{
@ -83,7 +83,7 @@ class SQLite3 extends CacheBase implements ICache
$this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
$result = $this->insertQuery->execute();
if ($result === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
$this->currentCellIsDirty = false;
}
@ -94,11 +94,11 @@ class SQLite3 extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$this->storeData();
@ -115,9 +115,9 @@ class SQLite3 extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -129,7 +129,7 @@ class SQLite3 extends CacheBase implements ICache
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
$cellResult = $this->selectQuery->execute();
if ($cellResult === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
if ($cellData === false) {
@ -152,7 +152,7 @@ class SQLite3 extends CacheBase implements ICache
* Is a value set for an indexed cell?
*
* @param string $pCoord Coordinate address of the cell to check
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return bool
*/
public function isDataSet($pCoord)
@ -165,7 +165,7 @@ class SQLite3 extends CacheBase implements ICache
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
$cellResult = $this->selectQuery->execute();
if ($cellResult === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
@ -176,7 +176,7 @@ class SQLite3 extends CacheBase implements ICache
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function deleteCacheData($pCoord)
{
@ -189,7 +189,7 @@ class SQLite3 extends CacheBase implements ICache
$this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
$result = $this->deleteQuery->execute();
if ($result === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
$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 $toAddress Destination address of the cell to move
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return bool
*/
public function moveCell($fromAddress, $toAddress)
@ -212,14 +212,14 @@ class SQLite3 extends CacheBase implements ICache
$this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
$result = $this->deleteQuery->execute();
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('fromid', $fromAddress, SQLITE3_TEXT);
$result = $this->updateQuery->execute();
if ($result === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
return true;
@ -228,7 +228,7 @@ class SQLite3 extends CacheBase implements ICache
/**
* Get a list of all cell addresses currently held in cache
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return string[]
*/
public function getCellList()
@ -240,7 +240,7 @@ class SQLite3 extends CacheBase implements ICache
$query = 'SELECT id FROM kvp_' . $this->TableName;
$cellIdsResult = $this->DBHandle->query($query);
if ($cellIdsResult === false) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
$cellKeys = [];
@ -254,10 +254,10 @@ class SQLite3 extends CacheBase implements ICache
/**
* Clone the cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
$this->currentCellIsDirty;
$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)
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
@ -293,10 +293,10 @@ class SQLite3 extends CacheBase implements ICache
/**
* Initialise this new cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The worksheet for this cell collection
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function __construct(\PhpSpreadsheet\Worksheet $parent)
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
parent::__construct($parent);
if (is_null($this->DBHandle)) {
@ -305,10 +305,10 @@ class SQLite3 extends CacheBase implements ICache
$this->DBHandle = new \SQLite3($_DBName);
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)')) {
throw new \PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg());
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CachedObjectStorage;
namespace PhpOffice\PhpSpreadsheet\CachedObjectStorage;
/**
* 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",
* and the 'nullify' the current cell object
*
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
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_set($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
$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 {
if (!wincache_ucache_add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
$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;
@ -73,11 +73,11 @@ class Wincache extends CacheBase implements ICache
* Add or Update a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to update
* @param \PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell
* @param \PhpOffice\PhpSpreadsheet\Cell $cell Cell to update
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @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)) {
$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
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return bool
*/
public function isDataSet($pCoord)
@ -110,7 +110,7 @@ class Wincache extends CacheBase implements ICache
if ($success === false) {
// Entry no longer exists in Wincache, so clear it from the cache array
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;
@ -123,8 +123,8 @@ class Wincache extends CacheBase implements ICache
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws \PhpSpreadsheet\Exception
* @return \PhpSpreadsheet\Cell Cell that was found, or null if not found
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \PhpOffice\PhpSpreadsheet\Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord)
{
@ -141,7 +141,7 @@ class Wincache extends CacheBase implements ICache
if ($success === false) {
// Entry no longer exists in WinCache, so clear it from the cache array
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 {
// 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
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws \PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function deleteCacheData($pCoord)
{
@ -190,10 +190,10 @@ class Wincache extends CacheBase implements ICache
/**
* Clone the cell collection
*
* @param \PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpSpreadsheet\Exception
* @param \PhpOffice\PhpSpreadsheet\Worksheet $parent The new worksheet that we're copying to
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
public function copyCellCollection(\PhpSpreadsheet\Worksheet $parent)
public function copyCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet $parent)
{
parent::copyCellCollection($parent);
// Get a new id for the new file name
@ -207,11 +207,11 @@ class Wincache extends CacheBase implements ICache
if ($success === false) {
// Entry no longer exists in WinCache, so clear it from the cache array
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)) {
$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
*
* @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
*/
public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
public function __construct(\PhpOffice\PhpSpreadsheet\Worksheet $parent, $arguments)
{
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet;
namespace PhpOffice\PhpSpreadsheet;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet
@ -148,7 +148,7 @@ class CachedObjectStorageFactory
{
$activeMethods = [];
foreach (self::$storageMethods as $storageMethod) {
$cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $storageMethod;
$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $storageMethod;
if (call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) {
$activeMethods[] = $storageMethod;
}
@ -171,7 +171,7 @@ class CachedObjectStorageFactory
return false;
}
$cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
if (!call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) {
return false;
}
@ -184,7 +184,7 @@ class CachedObjectStorageFactory
}
if (self::$cacheStorageMethod === null) {
self::$cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
self::$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $method;
self::$cacheStorageMethod = $method;
}

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CalcEngine;
namespace PhpOffice\PhpSpreadsheet\CalcEngine;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\CalcEngine;
namespace PhpOffice\PhpSpreadsheet\CalcEngine;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\Calculation;
namespace PhpOffice\PhpSpreadsheet\Calculation;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\Calculation;
namespace PhpOffice\PhpSpreadsheet\Calculation;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet
@ -114,12 +114,12 @@ class Database
$k = array_search($criteriaName, $fieldNames);
if (isset($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);
}
}
// 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 (!$result) {
unset($database[$dataRow]);

View File

@ -1,6 +1,6 @@
<?php
namespace PhpSpreadsheet\Calculation;
namespace PhpOffice\PhpSpreadsheet\Calculation;
/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet
@ -87,7 +87,7 @@ class DateTime
return Functions::VALUE();
}
if ((is_object($dateValue)) && ($dateValue instanceof \DateTime)) {
$dateValue = \PhpSpreadsheet\Shared\Date::PHPToExcel($dateValue);
$dateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateValue);
} else {
$saveReturnDateType = Functions::getReturnDateType();
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -118,7 +118,7 @@ class DateTime
private static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0)
{
// Execute function
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$oMonth = (int) $PHPDateObject->format('m');
$oYear = (int) $PHPDateObject->format('Y');
@ -167,7 +167,7 @@ class DateTime
$retValue = false;
switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL:
$retValue = (float) \PhpSpreadsheet\Shared\Date::PHPToExcel(time());
$retValue = (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time());
break;
case Functions::RETURNDATE_PHP_NUMERIC:
$retValue = (integer) time();
@ -204,16 +204,16 @@ class DateTime
$saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$retValue = false;
$excelDateTime = floor(\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
$excelDateTime = floor(\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL:
$retValue = (float) $excelDateTime;
break;
case Functions::RETURNDATE_PHP_NUMERIC:
$retValue = (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime);
$retValue = (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateTime);
break;
case Functions::RETURNDATE_PHP_OBJECT:
$retValue = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateTime);
$retValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateTime);
break;
}
date_default_timezone_set($saveTimeZone);
@ -277,16 +277,16 @@ class DateTime
$day = Functions::flattenSingleValue($day);
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))) {
$day = \PhpSpreadsheet\Shared\Date::dayStringToNumber($day);
$day = \PhpOffice\PhpSpreadsheet\Shared\Date::dayStringToNumber($day);
}
$year = ($year !== null) ? \PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($year) : 0;
$month = ($month !== null) ? \PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($month) : 0;
$day = ($day !== null) ? \PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($day) : 0;
$year = ($year !== null) ? \PhpOffice\PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($year) : 0;
$month = ($month !== null) ? \PhpOffice\PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($month) : 0;
$day = ($day !== null) ? \PhpOffice\PhpSpreadsheet\Shared\StringHelper::testStringAsNumeric($day) : 0;
if ((!is_numeric($year)) ||
(!is_numeric($month)) ||
(!is_numeric($day))) {
@ -296,7 +296,7 @@ class DateTime
$month = (integer) $month;
$day = (integer) $day;
$baseYear = \PhpSpreadsheet\Shared\Date::getExcelCalendar();
$baseYear = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
// Validate parameters
if ($year < ($baseYear - 1900)) {
return Functions::NAN();
@ -326,14 +326,14 @@ class DateTime
}
// Execute function
$excelDateValue = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day);
$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day);
switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue;
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:
return \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateValue);
return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDateValue);
}
}
@ -417,14 +417,14 @@ class DateTime
switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL:
$date = 0;
$calendar = \PhpSpreadsheet\Shared\Date::getExcelCalendar();
if ($calendar != \PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900) {
$calendar = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
if ($calendar != \PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900) {
$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:
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:
$dayAdjust = 0;
if ($hour < 0) {
@ -559,7 +559,7 @@ class DateTime
return Functions::VALUE();
}
$excelDateValue = floor(
\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$PHPDateArray['year'],
$PHPDateArray['month'],
$PHPDateArray['day'],
@ -572,7 +572,7 @@ class DateTime
case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue;
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:
return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00');
}
@ -616,7 +616,7 @@ class DateTime
$PHPDateArray = date_parse($timeValue);
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$excelDateValue = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
$PHPDateArray['year'],
$PHPDateArray['month'],
$PHPDateArray['day'],
@ -625,14 +625,14 @@ class DateTime
$PHPDateArray['second']
);
} 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()) {
case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue;
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:
return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']);
}
@ -672,12 +672,12 @@ class DateTime
// Execute function
$difference = $endDate - $startDate;
$PHPStartDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
$PHPStartDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
$startDays = $PHPStartDateObject->format('j');
$startMonths = $PHPStartDateObject->format('n');
$startYears = $PHPStartDateObject->format('Y');
$PHPEndDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
$PHPEndDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
$endDays = $PHPEndDateObject->format('j');
$endMonths = $PHPEndDateObject->format('n');
$endYears = $PHPEndDateObject->format('Y');
@ -791,12 +791,12 @@ class DateTime
}
// Execute function
$PHPStartDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
$PHPStartDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($startDate);
$startDay = $PHPStartDateObject->format('j');
$startMonth = $PHPStartDateObject->format('n');
$startYear = $PHPStartDateObject->format('Y');
$PHPEndDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
$PHPEndDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
$endDay = $PHPEndDateObject->format('j');
$endMonth = $PHPEndDateObject->format('n');
$endYear = $PHPEndDateObject->format('Y');
@ -1087,9 +1087,9 @@ class DateTime
case Functions::RETURNDATE_EXCEL:
return (float) $endDate;
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:
return \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
return \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($endDate);
}
}
@ -1121,7 +1121,7 @@ class DateTime
}
// Execute function
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('j');
}
@ -1164,7 +1164,7 @@ class DateTime
}
// Execute function
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$DoW = $PHPDateObject->format('w');
$firstDay = 1;
@ -1239,7 +1239,7 @@ class DateTime
}
// Execute function
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$dayOfYear = $PHPDateObject->format('z');
$PHPDateObject->modify('-' . $dayOfYear . ' days');
$dow = $PHPDateObject->format('w');
@ -1277,7 +1277,7 @@ class DateTime
}
// Execute function
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('n');
}
@ -1308,7 +1308,7 @@ class DateTime
}
// Execute function
$PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
$PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
return (int) $PHPDateObject->format('Y');
}
@ -1348,7 +1348,7 @@ class DateTime
} elseif ($timeValue < 0.0) {
return Functions::NAN();
}
$timeValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
$timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
return (int) gmdate('G', $timeValue);
}
@ -1388,7 +1388,7 @@ class DateTime
} elseif ($timeValue < 0.0) {
return Functions::NAN();
}
$timeValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
$timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
return (int) gmdate('i', $timeValue);
}
@ -1428,7 +1428,7 @@ class DateTime
} elseif ($timeValue < 0.0) {
return Functions::NAN();
}
$timeValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
$timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue);
return (int) gmdate('s', $timeValue);
}
@ -1471,9 +1471,9 @@ class DateTime
switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL:
return (float) \PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
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:
return $PHPDateObject;
}
@ -1519,9 +1519,9 @@ class DateTime
switch (Functions::getReturnDateType()) {
case Functions::RETURNDATE_EXCEL:
return (float) \PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
return (float) \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDateObject);
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:
return $PHPDateObject;
}

Some files were not shown because too many files have changed in this diff Show More