diff --git a/bin/migrate-from-phpexcel b/bin/migrate-from-phpexcel
index 416c3a42..51c60d49 100755
--- a/bin/migrate-from-phpexcel
+++ b/bin/migrate-from-phpexcel
@@ -1,6 +1,8 @@
#!/usr/bin/env php
migrate();
diff --git a/docs/Examples/Calculations/Database/DAVERAGE.php b/docs/Examples/Calculations/Database/DAVERAGE.php
index b54a7d1d..c2d31a6a 100644
--- a/docs/Examples/Calculations/Database/DAVERAGE.php
+++ b/docs/Examples/Calculations/Database/DAVERAGE.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DCOUNT.php b/docs/Examples/Calculations/Database/DCOUNT.php
index 2cd0661d..d7bf2045 100644
--- a/docs/Examples/Calculations/Database/DCOUNT.php
+++ b/docs/Examples/Calculations/Database/DCOUNT.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DGET.php b/docs/Examples/Calculations/Database/DGET.php
index d64b1d6e..819120cb 100644
--- a/docs/Examples/Calculations/Database/DGET.php
+++ b/docs/Examples/Calculations/Database/DGET.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DMAX.php b/docs/Examples/Calculations/Database/DMAX.php
index 58d2f039..4fe13da6 100644
--- a/docs/Examples/Calculations/Database/DMAX.php
+++ b/docs/Examples/Calculations/Database/DMAX.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DMIN.php b/docs/Examples/Calculations/Database/DMIN.php
index e4fb7658..b765c061 100644
--- a/docs/Examples/Calculations/Database/DMIN.php
+++ b/docs/Examples/Calculations/Database/DMIN.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DPRODUCT.php b/docs/Examples/Calculations/Database/DPRODUCT.php
index 382227df..4cf234d3 100644
--- a/docs/Examples/Calculations/Database/DPRODUCT.php
+++ b/docs/Examples/Calculations/Database/DPRODUCT.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DSTDEV.php b/docs/Examples/Calculations/Database/DSTDEV.php
index e1273e5a..8aeaf2d8 100644
--- a/docs/Examples/Calculations/Database/DSTDEV.php
+++ b/docs/Examples/Calculations/Database/DSTDEV.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DSTDEVP.php b/docs/Examples/Calculations/Database/DSTDEVP.php
index 3af791bb..0a562c65 100644
--- a/docs/Examples/Calculations/Database/DSTDEVP.php
+++ b/docs/Examples/Calculations/Database/DSTDEVP.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DVAR.php b/docs/Examples/Calculations/Database/DVAR.php
index 44e63994..b49020bf 100644
--- a/docs/Examples/Calculations/Database/DVAR.php
+++ b/docs/Examples/Calculations/Database/DVAR.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/Database/DVARP.php b/docs/Examples/Calculations/Database/DVARP.php
index c630e731..83d06fba 100644
--- a/docs/Examples/Calculations/Database/DVARP.php
+++ b/docs/Examples/Calculations/Database/DVARP.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/DateTime/DATE.php b/docs/Examples/Calculations/DateTime/DATE.php
index 1af05e3e..5b0a8717 100644
--- a/docs/Examples/Calculations/DateTime/DATE.php
+++ b/docs/Examples/Calculations/DateTime/DATE.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/DateTime/DATEVALUE.php b/docs/Examples/Calculations/DateTime/DATEVALUE.php
index 42996a4e..437b6aa8 100644
--- a/docs/Examples/Calculations/DateTime/DATEVALUE.php
+++ b/docs/Examples/Calculations/DateTime/DATEVALUE.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/DateTime/TIME.php b/docs/Examples/Calculations/DateTime/TIME.php
index 9c206304..588eadf9 100644
--- a/docs/Examples/Calculations/DateTime/TIME.php
+++ b/docs/Examples/Calculations/DateTime/TIME.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Calculations/DateTime/TIMEVALUE.php b/docs/Examples/Calculations/DateTime/TIMEVALUE.php
index c5745cc2..26996b61 100644
--- a/docs/Examples/Calculations/DateTime/TIMEVALUE.php
+++ b/docs/Examples/Calculations/DateTime/TIMEVALUE.php
@@ -1,5 +1,7 @@
getActiveSheet();
// Add some data
diff --git a/docs/Examples/Reader/exampleReader01.php b/docs/Examples/Reader/exampleReader01.php
index 9ef1f565..d20207a2 100644
--- a/docs/Examples/Reader/exampleReader01.php
+++ b/docs/Examples/Reader/exampleReader01.php
@@ -1,5 +1,7 @@
PhpSpreadsheet Reader Example #01
-Simple File Reader using \PhpOffice\PhpSpreadsheet\IOFactory::load()
+Simple File Reader using IOFactory::load()
';
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
+$spreadsheet = IOFactory::load($inputFileName);
echo '
';
diff --git a/docs/Examples/Reader/exampleReader02.php b/docs/Examples/Reader/exampleReader02.php
index b98b860d..9d301f69 100644
--- a/docs/Examples/Reader/exampleReader02.php
+++ b/docs/Examples/Reader/exampleReader02.php
@@ -1,5 +1,7 @@
';
-$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
+$reader = new Xls();
// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml();
// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods();
diff --git a/docs/Examples/Reader/exampleReader03.php b/docs/Examples/Reader/exampleReader03.php
index dbd584b4..07dfa7ae 100644
--- a/docs/Examples/Reader/exampleReader03.php
+++ b/docs/Examples/Reader/exampleReader03.php
@@ -1,5 +1,7 @@
PhpSpreadsheet Reader Example #03
-Simple File Reader using the \PhpOffice\PhpSpreadsheet\IOFactory to Return a Reader
+Simple File Reader using the IOFactory to Return a Reader
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
$spreadsheet = $reader->load($inputFileName);
echo '
';
diff --git a/docs/Examples/Reader/exampleReader04.php b/docs/Examples/Reader/exampleReader04.php
index 2267a9df..d26d6525 100644
--- a/docs/Examples/Reader/exampleReader04.php
+++ b/docs/Examples/Reader/exampleReader04.php
@@ -1,5 +1,7 @@
PhpSpreadsheet Reader Example #04
-Simple File Reader using the \PhpOffice\PhpSpreadsheet\IOFactory to Identify a Reader to Use
+Simple File Reader using the IOFactory to Identify a Reader to Use
';
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with the identified reader type
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
$spreadsheet = $reader->load($inputFileName);
echo '
';
diff --git a/docs/Examples/Reader/exampleReader05.php b/docs/Examples/Reader/exampleReader05.php
index 807e910d..ff72be92 100644
--- a/docs/Examples/Reader/exampleReader05.php
+++ b/docs/Examples/Reader/exampleReader05.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo 'Turning Formatting off for Load
';
$reader->setReadDataOnly(true);
$spreadsheet = $reader->load($inputFileName);
diff --git a/docs/Examples/Reader/exampleReader06.php b/docs/Examples/Reader/exampleReader06.php
index 84675c17..ccc59373 100644
--- a/docs/Examples/Reader/exampleReader06.php
+++ b/docs/Examples/Reader/exampleReader06.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo 'Loading all WorkSheets
';
$reader->setLoadAllSheets();
$spreadsheet = $reader->load($inputFileName);
diff --git a/docs/Examples/Reader/exampleReader07.php b/docs/Examples/Reader/exampleReader07.php
index 0463f37b..cde1c409 100644
--- a/docs/Examples/Reader/exampleReader07.php
+++ b/docs/Examples/Reader/exampleReader07.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only
';
$reader->setLoadSheetsOnly($sheetname);
$spreadsheet = $reader->load($inputFileName);
diff --git a/docs/Examples/Reader/exampleReader08.php b/docs/Examples/Reader/exampleReader08.php
index c5e9b39d..0a739f75 100644
--- a/docs/Examples/Reader/exampleReader08.php
+++ b/docs/Examples/Reader/exampleReader08.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and "', $sheetnames),'" only
';
$reader->setLoadSheetsOnly($sheetnames);
$spreadsheet = $reader->load($inputFileName);
diff --git a/docs/Examples/Reader/exampleReader09.php b/docs/Examples/Reader/exampleReader09.php
index e2464447..8dde497c 100644
--- a/docs/Examples/Reader/exampleReader09.php
+++ b/docs/Examples/Reader/exampleReader09.php
@@ -1,5 +1,8 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only
';
$reader->setLoadSheetsOnly($sheetname);
echo 'Loading Sheet using filter
';
diff --git a/docs/Examples/Reader/exampleReader10.php b/docs/Examples/Reader/exampleReader10.php
index 965a1bb2..f62c98d93 100644
--- a/docs/Examples/Reader/exampleReader10.php
+++ b/docs/Examples/Reader/exampleReader10.php
@@ -1,5 +1,8 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only
';
$reader->setLoadSheetsOnly($sheetname);
echo 'Loading Sheet using configurable filter
';
diff --git a/docs/Examples/Reader/exampleReader11.php b/docs/Examples/Reader/exampleReader11.php
index 5435629a..2b7225a9 100644
--- a/docs/Examples/Reader/exampleReader11.php
+++ b/docs/Examples/Reader/exampleReader11.php
@@ -1,5 +1,8 @@
';
/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo '
';
diff --git a/docs/Examples/Reader/exampleReader12.php b/docs/Examples/Reader/exampleReader12.php
index 673b2f14..50580f2a 100644
--- a/docs/Examples/Reader/exampleReader12.php
+++ b/docs/Examples/Reader/exampleReader12.php
@@ -1,5 +1,8 @@
';
/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo '
';
diff --git a/docs/Examples/Reader/exampleReader13.php b/docs/Examples/Reader/exampleReader13.php
index 9977a83c..c5107c87 100644
--- a/docs/Examples/Reader/exampleReader13.php
+++ b/docs/Examples/Reader/exampleReader13.php
@@ -1,5 +1,7 @@
';
$spreadsheet = $reader->load($inputFileName);
diff --git a/docs/Examples/Reader/exampleReader14.php b/docs/Examples/Reader/exampleReader14.php
index 933be4ac..aad066dc 100644
--- a/docs/Examples/Reader/exampleReader14.php
+++ b/docs/Examples/Reader/exampleReader14.php
@@ -1,5 +1,9 @@
';
/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
echo '
';
@@ -71,7 +75,7 @@ $reader->setReadFilter($chunkFilter)
->setContiguous(true);
/* Instantiate a new PhpSpreadsheet object manually **/
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
/* Set a sheet index **/
$sheet = 0;
diff --git a/docs/Examples/Reader/exampleReader15.php b/docs/Examples/Reader/exampleReader15.php
index a04a1adc..fdf38b05 100644
--- a/docs/Examples/Reader/exampleReader15.php
+++ b/docs/Examples/Reader/exampleReader15.php
@@ -1,5 +1,8 @@
';
$reader->setDelimiter("\t");
$spreadsheet = $reader->load($inputFileName);
diff --git a/docs/Examples/Reader/exampleReader16.php b/docs/Examples/Reader/exampleReader16.php
index 6e6a7583..9436bd2e 100644
--- a/docs/Examples/Reader/exampleReader16.php
+++ b/docs/Examples/Reader/exampleReader16.php
@@ -1,5 +1,8 @@
';
try {
- $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
-} catch (\InvalidArgumentException $e) {
+ $spreadsheet = IOFactory::load($inputFileName);
+} catch (InvalidArgumentException $e) {
die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
}
diff --git a/docs/Examples/Reader/exampleReader17.php b/docs/Examples/Reader/exampleReader17.php
index f76994e9..763805ac 100644
--- a/docs/Examples/Reader/exampleReader17.php
+++ b/docs/Examples/Reader/exampleReader17.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
/* Read the list of Worksheet Names from the Workbook file **/
echo 'Read the list of Worksheets in the WorkBook
';
diff --git a/docs/Examples/Reader/exampleReader18.php b/docs/Examples/Reader/exampleReader18.php
index 6688e481..9822b209 100644
--- a/docs/Examples/Reader/exampleReader18.php
+++ b/docs/Examples/Reader/exampleReader18.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
$worksheetNames = $reader->listWorksheetNames($inputFileName);
echo 'Worksheet Names
';
diff --git a/docs/Examples/Reader/exampleReader19.php b/docs/Examples/Reader/exampleReader19.php
index 5ad3e5ba..5749d1b6 100644
--- a/docs/Examples/Reader/exampleReader19.php
+++ b/docs/Examples/Reader/exampleReader19.php
@@ -1,5 +1,7 @@
';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$reader = IOFactory::createReader($inputFileType);
$worksheetData = $reader->listWorksheetInfo($inputFileName);
echo 'Worksheet Information
';
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
index aa9bddd7..8a6b4726 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
@@ -1,5 +1,7 @@
load($inputFileName);
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
index c021728c..b9cfc196 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
@@ -1,5 +1,7 @@
load($inputFileName);
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
index c02f51bd..81327481 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
@@ -1,5 +1,7 @@
load($inputFileName);
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
index 88c7f9e0..e3a71d34 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
@@ -1,5 +1,7 @@
load($inputFileName);
diff --git a/samples/01_Simple.php b/samples/01_Simple.php
index d21de72e..3ba6ba05 100644
--- a/samples/01_Simple.php
+++ b/samples/01_Simple.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/01_Simple_download_ods.php b/samples/01_Simple_download_ods.php
index 8e76e8cf..4031eec6 100644
--- a/samples/01_Simple_download_ods.php
+++ b/samples/01_Simple_download_ods.php
@@ -1,8 +1,12 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@@ -10,7 +14,7 @@ if ($helper->isCli()) {
}
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -52,6 +56,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 = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
+$writer = IOFactory::createWriter($spreadsheet, 'Ods');
$writer->save('php://output');
exit;
diff --git a/samples/01_Simple_download_pdf.php b/samples/01_Simple_download_pdf.php
index dc23daa0..04c91a18 100644
--- a/samples/01_Simple_download_pdf.php
+++ b/samples/01_Simple_download_pdf.php
@@ -1,8 +1,13 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@@ -12,11 +17,11 @@ if ($helper->isCli()) {
// Change these values to select the Rendering library that you wish to use
// and its directory location on your server
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
+$rendererName = Settings::PDF_RENDERER_MPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -46,13 +51,13 @@ $spreadsheet->getActiveSheet()->setShowGridLines(false);
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$spreadsheet->setActiveSheetIndex(0);
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Redirect output to a client’s web browser (PDF)
header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="01simple.pdf"');
header('Cache-Control: max-age=0');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf');
+$writer = IOFactory::createWriter($spreadsheet, 'Pdf');
$writer->save('php://output');
exit;
diff --git a/samples/01_Simple_download_xls.php b/samples/01_Simple_download_xls.php
index 7bfd5cc6..71fcbc7e 100644
--- a/samples/01_Simple_download_xls.php
+++ b/samples/01_Simple_download_xls.php
@@ -1,8 +1,12 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@@ -10,7 +14,7 @@ if ($helper->isCli()) {
}
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -52,6 +56,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 = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$writer->save('php://output');
exit;
diff --git a/samples/01_Simple_download_xlsx.php b/samples/01_Simple_download_xlsx.php
index 3881d4cc..45ba9bc3 100644
--- a/samples/01_Simple_download_xlsx.php
+++ b/samples/01_Simple_download_xlsx.php
@@ -1,15 +1,19 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
return;
}
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -51,6 +55,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 = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output');
exit;
diff --git a/samples/02_Types.php b/samples/02_Types.php
index 5fef248d..84bc5002 100644
--- a/samples/02_Types.php
+++ b/samples/02_Types.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -70,41 +76,41 @@ $dateTimeNow = time();
$spreadsheet->getActiveSheet()
->setCellValue('A9', 'Date/Time')
->setCellValue('B9', 'Date')
- ->setCellValue('C9', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
+ ->setCellValue('C9', Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C9')
->getNumberFormat()
- ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
+ ->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
$spreadsheet->getActiveSheet()
->setCellValue('A10', 'Date/Time')
->setCellValue('B10', 'Time')
- ->setCellValue('C10', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
+ ->setCellValue('C10', Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C10')
->getNumberFormat()
- ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4);
+ ->setFormatCode(NumberFormat::FORMAT_DATE_TIME4);
$spreadsheet->getActiveSheet()
->setCellValue('A11', 'Date/Time')
->setCellValue('B11', 'Date and Time')
- ->setCellValue('C11', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
+ ->setCellValue('C11', Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C11')
->getNumberFormat()
- ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
+ ->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME);
$spreadsheet->getActiveSheet()
->setCellValue('A12', 'NULL')
->setCellValue('C12', null);
-$richText = new \PhpOffice\PhpSpreadsheet\RichText();
+$richText = new RichText();
$richText->createText('你好 ');
$payable = $richText->createTextRun('你 好 吗?');
$payable->getFont()->setBold(true);
$payable->getFont()->setItalic(true);
-$payable->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN));
+$payable->getFont()->setColor(new Color(Color::COLOR_DARKGREEN));
$richText->createText(', unless specified otherwise on the invoice.');
@@ -112,11 +118,11 @@ $spreadsheet->getActiveSheet()
->setCellValue('A13', 'Rich Text')
->setCellValue('C13', $richText);
-$richText2 = new \PhpOffice\PhpSpreadsheet\RichText();
+$richText2 = new RichText();
$richText2->createText("black text\n");
$red = $richText2->createTextRun('red text');
-$red->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED));
+$red->getFont()->setColor(new Color(Color::COLOR_RED));
$spreadsheet->getActiveSheet()
->getCell('C14')
diff --git a/samples/03_Formulas.php b/samples/03_Formulas.php
index 8896253c..752b99c8 100644
--- a/samples/03_Formulas.php
+++ b/samples/03_Formulas.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/04_Printing.php b/samples/04_Printing.php
index 4434b2f5..e8854821 100644
--- a/samples/04_Printing.php
+++ b/samples/04_Printing.php
@@ -1,10 +1,15 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -34,22 +39,22 @@ $spreadsheet->getActiveSheet()
// Add a drawing to the header
$helper->log('Add a drawing to the header');
-$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing();
+$drawing = new HeaderFooterDrawing();
$drawing->setName('PhpSpreadsheet logo');
$drawing->setPath(__DIR__ . '/images/PhpSpreadsheet_logo.png');
$drawing->setHeight(36);
$spreadsheet->getActiveSheet()
->getHeaderFooter()
- ->addImage($drawing, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
+ ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT);
// Set page orientation and size
$helper->log('Set page orientation and size');
$spreadsheet->getActiveSheet()
->getPageSetup()
- ->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+ ->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()
->getPageSetup()
- ->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
+ ->setPaperSize(PageSetup::PAPERSIZE_A4);
// Rename worksheet
$helper->log('Rename worksheet');
diff --git a/samples/07_Reader.php b/samples/07_Reader.php
index 2e7b9610..05186521 100644
--- a/samples/07_Reader.php
+++ b/samples/07_Reader.php
@@ -1,15 +1,18 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$writer->save($filename);
$callStartTime = microtime(true);
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheet = IOFactory::load($filename);
$helper->logRead('Xlsx', $filename, $callStartTime);
// Save
diff --git a/samples/08_Conditional_formatting.php b/samples/08_Conditional_formatting.php
index 86019305..36c3aaee 100644
--- a/samples/08_Conditional_formatting.php
+++ b/samples/08_Conditional_formatting.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -47,30 +53,30 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12);
// Add conditional formatting
$helper->log('Add conditional formatting');
-$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_BETWEEN)
+$conditional1 = new Conditional();
+$conditional1->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_BETWEEN)
->addCondition('200')
->addCondition('400');
-$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_YELLOW);
+$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_YELLOW);
$conditional1->getStyle()->getFont()->setBold(true);
-$conditional1->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+$conditional1->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
-$conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
+$conditional2 = new Conditional();
+$conditional2->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_LESSTHAN)
->addCondition('0');
-$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
+$conditional2->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED);
$conditional2->getStyle()->getFont()->setItalic(true);
-$conditional2->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+$conditional2->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
-$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
+$conditional3 = new Conditional();
+$conditional3->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL)
->addCondition('0');
-$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
+$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN);
$conditional3->getStyle()->getFont()->setItalic(true);
-$conditional3->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+$conditional3->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles();
array_push($conditionalStyles, $conditional1);
@@ -98,8 +104,8 @@ $spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spread
// Set page orientation and size
$helper->log('Set page orientation and size');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
-$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_PORTRAIT);
+$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(PageSetup::PAPERSIZE_A4);
// Rename worksheet
$helper->log('Rename worksheet');
diff --git a/samples/08_Conditional_formatting_2.php b/samples/08_Conditional_formatting_2.php
index 87bd2851..07d2361d 100644
--- a/samples/08_Conditional_formatting_2.php
+++ b/samples/08_Conditional_formatting_2.php
@@ -1,10 +1,15 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -32,22 +37,22 @@ $spreadsheet->getActiveSheet()
$spreadsheet->getActiveSheet()->getStyle('A1:A8')
->getNumberFormat()
->setFormatCode(
- \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00
+ NumberFormat::FORMAT_PERCENTAGE_00
);
// Add conditional formatting
$helper->log('Add conditional formatting');
-$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
+$conditional1 = new Conditional();
+$conditional1->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_LESSTHAN)
->addCondition('0');
-$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
+$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED);
-$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
+$conditional3 = new Conditional();
+$conditional3->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL)
->addCondition('1');
-$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
+$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN);
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles();
array_push($conditionalStyles, $conditional1);
diff --git a/samples/09_Pagebreaks.php b/samples/09_Pagebreaks.php
index 9b91d2f0..c4cf33af 100644
--- a/samples/09_Pagebreaks.php
+++ b/samples/09_Pagebreaks.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -36,7 +39,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, \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_ROW);
+ $spreadsheet->getActiveSheet()->setBreak('A' . $i, Worksheet::BREAK_ROW);
}
}
diff --git a/samples/10_Autofilter.php b/samples/10_Autofilter.php
index 45955a8c..7058e6a5 100644
--- a/samples/10_Autofilter.php
+++ b/samples/10_Autofilter.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/10_Autofilter_selection_1.php b/samples/10_Autofilter_selection_1.php
index 6f74f483..1b34b019 100644
--- a/samples/10_Autofilter_selection_1.php
+++ b/samples/10_Autofilter_selection_1.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +54,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 = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
+ $eDate = Date::formattedPHPToExcel(
$year,
$period,
$i
@@ -86,8 +92,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(\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()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@@ -104,45 +110,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(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'japan'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(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(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
[
'year' => $currentYear,
'month' => $period,
'day' => $endDate,
]
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP);
}
// Display only sales values that are blank
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);
diff --git a/samples/10_Autofilter_selection_2.php b/samples/10_Autofilter_selection_2.php
index 1802d0ea..9bfb254a 100644
--- a/samples/10_Autofilter_selection_2.php
+++ b/samples/10_Autofilter_selection_2.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +54,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 = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
+ $eDate = Date::formattedPHPToExcel(
$year,
$period,
$i
@@ -86,8 +92,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(\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()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@@ -104,39 +110,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(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'Germany'
);
// Filter the Date column on a filter value of the year to date
$autoFilter->getColumn('D')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
null,
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
+ Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
// Display only sales values that are between 400 and 600
$autoFilter->getColumn('E')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
400
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('E')
- ->setJoin(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
+ ->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
600
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
// Save
$helper->write($spreadsheet, __FILE__);
diff --git a/samples/10_Autofilter_selection_display.php b/samples/10_Autofilter_selection_display.php
index 0f431e66..2be654d3 100644
--- a/samples/10_Autofilter_selection_display.php
+++ b/samples/10_Autofilter_selection_display.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +54,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 = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
+ $eDate = Date::formattedPHPToExcel(
$year,
$period,
$i
@@ -86,8 +92,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(\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()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@@ -104,45 +110,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(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'japan'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(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(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
[
'year' => $currentYear,
'month' => $period,
'day' => $endDate,
]
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP);
}
// Display only sales values that are blank
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);
diff --git a/samples/11_Documentsecurity.php b/samples/11_Documentsecurity.php
index 2224808a..0298e7ee 100644
--- a/samples/11_Documentsecurity.php
+++ b/samples/11_Documentsecurity.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/12_CellProtection.php b/samples/12_CellProtection.php
index 4ef97b01..a84bb8a5 100644
--- a/samples/12_CellProtection.php
+++ b/samples/12_CellProtection.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -37,7 +40,7 @@ $spreadsheet->getActiveSheet()->getProtection()->setSheet(true);
$spreadsheet->getActiveSheet()
->getStyle('A2:B2')
->getProtection()->setLocked(
- \PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED
+ Protection::PROTECTION_UNPROTECTED
);
// Save
diff --git a/samples/13_Calculation.php b/samples/13_Calculation.php
index d620a6f2..e143e9ab 100644
--- a/samples/13_Calculation.php
+++ b/samples/13_Calculation.php
@@ -1,17 +1,20 @@
log('List implemented functions');
-$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
+$calc = Calculation::getInstance();
print_r($calc->getImplementedFunctionNames());
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Add some data, we will use some formulas here
$helper->log('Add some data and formulas');
diff --git a/samples/13_CalculationCyclicFormulae.php b/samples/13_CalculationCyclicFormulae.php
index ea1be404..968c467c 100644
--- a/samples/13_CalculationCyclicFormulae.php
+++ b/samples/13_CalculationCyclicFormulae.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Add some data, we will use some formulas here
$helper->log('Add some data and formulas');
@@ -13,7 +16,7 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', '=B1')
->setCellValue('B1', '=A1+1')
->setCellValue('B2', '=A2');
-\PhpOffice\PhpSpreadsheet\Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
+Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
// Calculated data
$helper->log('Calculated data');
diff --git a/samples/14_Xls.php b/samples/14_Xls.php
index 86d125b9..03a38d28 100644
--- a/samples/14_Xls.php
+++ b/samples/14_Xls.php
@@ -1,10 +1,12 @@
getFilename(__FILE__, 'xls');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/15_Datavalidation.php b/samples/15_Datavalidation.php
index bd7299d6..416a102a 100644
--- a/samples/15_Datavalidation.php
+++ b/samples/15_Datavalidation.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -35,8 +38,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(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE);
-$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
+$validation->setType(DataValidation::TYPE_WHOLE);
+$validation->setErrorStyle(DataValidation::STYLE_STOP);
$validation->setAllowBlank(true);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
@@ -48,8 +51,8 @@ $validation->setFormula1(10);
$validation->setFormula2(20);
$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
-$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
+$validation->setType(DataValidation::TYPE_LIST);
+$validation->setErrorStyle(DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(false);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
@@ -61,8 +64,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(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
-$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
+$validation->setType(DataValidation::TYPE_LIST);
+$validation->setErrorStyle(DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(false);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
diff --git a/samples/16_Csv.php b/samples/16_Csv.php
index 63cbd53e..0c1db51d 100644
--- a/samples/16_Csv.php
+++ b/samples/16_Csv.php
@@ -1,10 +1,12 @@
log('Write to CSV format');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',')
+$writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
@@ -15,7 +17,7 @@ $helper->logWrite($writer, $filename, $callStartTime);
$helper->log('Read from CSV format');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Csv')->setDelimiter(',')
+$reader = IOFactory::createReader('Csv')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
@@ -28,7 +30,7 @@ $helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']);
// Write CSV
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
-$writerCSV = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'Csv');
+$writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv');
$writerCSV->setExcelCompatibility(true);
$callStartTime = microtime(true);
diff --git a/samples/17_Html.php b/samples/17_Html.php
index d3dfd5b0..9ea9f0bd 100644
--- a/samples/17_Html.php
+++ b/samples/17_Html.php
@@ -1,10 +1,12 @@
getFilename(__FILE__, 'html');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Html');
+$writer = IOFactory::createWriter($spreadsheet, 'Html');
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/18_Extendedcalculation.php b/samples/18_Extendedcalculation.php
index b7d45b33..e459e9d3 100644
--- a/samples/18_Extendedcalculation.php
+++ b/samples/18_Extendedcalculation.php
@@ -1,16 +1,18 @@
log('List implemented functions');
-$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
+$calc = Calculation::getInstance();
print_r($calc->getImplementedFunctionNames());
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Add some data, we will use some formulas here
$helper->log('Add some data');
diff --git a/samples/19_Namedrange.php b/samples/19_Namedrange.php
index ea39a335..53c25660 100644
--- a/samples/19_Namedrange.php
+++ b/samples/19_Namedrange.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -28,8 +31,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:')
// Define named ranges
$helper->log('Define named ranges');
-$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
-$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
+$spreadsheet->addNamedRange(new NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
+$spreadsheet->addNamedRange(new NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
// Rename named ranges
$helper->log('Rename named ranges');
diff --git a/samples/20_Read_Excel2003XML.php b/samples/20_Read_Excel2003XML.php
index e6c1a797..6e2f464d 100644
--- a/samples/20_Read_Excel2003XML.php
+++ b/samples/20_Read_Excel2003XML.php
@@ -1,10 +1,12 @@
logRead('Xml', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Gnumeric.php b/samples/20_Read_Gnumeric.php
index d390dc14..d2c598c4 100644
--- a/samples/20_Read_Gnumeric.php
+++ b/samples/20_Read_Gnumeric.php
@@ -1,10 +1,12 @@
logRead('Gnumeric', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Ods.php b/samples/20_Read_Ods.php
index 37f7d4f7..10a8275c 100644
--- a/samples/20_Read_Ods.php
+++ b/samples/20_Read_Ods.php
@@ -1,10 +1,12 @@
logRead('Ods', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Sylk.php b/samples/20_Read_Sylk.php
index b3baa5a5..c07c9647 100644
--- a/samples/20_Read_Sylk.php
+++ b/samples/20_Read_Sylk.php
@@ -1,10 +1,12 @@
logRead('Slk', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Xls.php b/samples/20_Read_Xls.php
index ef8b1eda..542f96a2 100644
--- a/samples/20_Read_Xls.php
+++ b/samples/20_Read_Xls.php
@@ -1,19 +1,21 @@
getTemporaryFilename('xls');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
// Read Xls file
$callStartTime = microtime(true);
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheet = IOFactory::load($filename);
$helper->logRead('Xls', $filename, $callStartTime);
// Save
diff --git a/samples/21_Pdf_Domdf.php b/samples/21_Pdf_Domdf.php
index bc891d6f..f13ca72c 100644
--- a/samples/21_Pdf_Domdf.php
+++ b/samples/21_Pdf_Domdf.php
@@ -1,5 +1,8 @@
log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
+$rendererName = Settings::PDF_RENDERER_DOMPDF;
$helper->log("Write to PDF format using {$rendererName}");
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['Pdf']);
diff --git a/samples/21_Pdf_TCPDF.php b/samples/21_Pdf_TCPDF.php
index 980069fc..1bf75c84 100644
--- a/samples/21_Pdf_TCPDF.php
+++ b/samples/21_Pdf_TCPDF.php
@@ -1,5 +1,8 @@
log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
+$rendererName = Settings::PDF_RENDERER_TCPDF;
$helper->log("Write to PDF format using {$rendererName}");
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['Pdf']);
diff --git a/samples/21_Pdf_mPDF.php b/samples/21_Pdf_mPDF.php
index b5327a61..8e46f838 100644
--- a/samples/21_Pdf_mPDF.php
+++ b/samples/21_Pdf_mPDF.php
@@ -1,5 +1,8 @@
log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
+$rendererName = Settings::PDF_RENDERER_MPDF;
$helper->log("Write to PDF format using {$rendererName}");
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['Pdf']);
diff --git a/samples/22_Heavily_formatted.php b/samples/22_Heavily_formatted.php
index 541f3149..ea4cd804 100644
--- a/samples/22_Heavily_formatted.php
+++ b/samples/22_Heavily_formatted.php
@@ -1,10 +1,14 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -22,19 +26,19 @@ $spreadsheet->setActiveSheetIndex(0);
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'type' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'],
],
'borders' => [
- 'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
- 'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
+ 'bottom' => ['style' => Border::BORDER_THIN],
+ 'right' => ['style' => Border::BORDER_MEDIUM],
],
]
);
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'type' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'],
],
]
diff --git a/samples/23_Sharedstyles.php b/samples/23_Sharedstyles.php
index 48ffb1ad..74e3d8d6 100644
--- a/samples/23_Sharedstyles.php
+++ b/samples/23_Sharedstyles.php
@@ -1,10 +1,15 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -20,29 +25,29 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
$helper->log('Add some data');
$spreadsheet->setActiveSheetIndex(0);
-$sharedStyle1 = new \PhpOffice\PhpSpreadsheet\Style();
-$sharedStyle2 = new \PhpOffice\PhpSpreadsheet\Style();
+$sharedStyle1 = new Style();
+$sharedStyle2 = new Style();
$sharedStyle1->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'type' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'],
],
'borders' => [
- 'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
- 'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
+ 'bottom' => ['style' => Border::BORDER_THIN],
+ 'right' => ['style' => Border::BORDER_MEDIUM],
],
]
);
$sharedStyle2->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'type' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'],
],
'borders' => [
- 'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
- 'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
+ 'bottom' => ['style' => Border::BORDER_THIN],
+ 'right' => ['style' => Border::BORDER_MEDIUM],
],
]
);
diff --git a/samples/24_Readfilter.php b/samples/24_Readfilter.php
index 17912705..f5258604 100644
--- a/samples/24_Readfilter.php
+++ b/samples/24_Readfilter.php
@@ -2,17 +2,20 @@
namespace PhpOffice\PhpSpreadsheet;
+use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
+use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
+
require __DIR__ . '/Header.php';
// Write temporary file
$largeSpreadsheet = require __DIR__ . '/templates/largeSpreadsheet.php';
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($largeSpreadsheet);
+$writer = new Xlsx($largeSpreadsheet);
$filename = $helper->getTemporaryFilename();
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
-class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
+class MyReadFilter implements IReadFilter
{
public function readCell($column, $row, $worksheetName = '')
{
@@ -26,7 +29,7 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
}
$helper->log('Load from Xlsx file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$reader->setReadFilter(new MyReadFilter());
$callStartTime = microtime(true);
$spreadsheet = $reader->load($filename);
diff --git a/samples/25_In_memory_image.php b/samples/25_In_memory_image.php
index aef166f1..5756bd3e 100644
--- a/samples/25_In_memory_image.php
+++ b/samples/25_In_memory_image.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -24,12 +27,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 \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing();
+$drawing = new MemoryDrawing();
$drawing->setName('Sample image');
$drawing->setDescription('Sample image');
$drawing->setImageResource($gdImage);
-$drawing->setRenderingFunction(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG);
-$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
+$drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG);
+$drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT);
$drawing->setHeight(36);
$drawing->setWorksheet($spreadsheet->getActiveSheet());
diff --git a/samples/26_Utf8.php b/samples/26_Utf8.php
index 105b0f94..790640a0 100644
--- a/samples/26_Utf8.php
+++ b/samples/26_Utf8.php
@@ -1,16 +1,19 @@
log('Load Xlsx template file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load(__DIR__ . '/templates/26template.xlsx');
/* at this point, we could do some manipulations with the template, but we skip this step */
@@ -18,7 +21,7 @@ $helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
// Export to PDF (.pdf)
$helper->log('Write to PDF format');
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
$helper->write($spreadsheet, __FILE__, ['Pdf']);
// Remove first two rows with field headers before exporting to CSV
@@ -28,7 +31,7 @@ $worksheet->removeRow(1, 2);
// Export to CSV (.csv)
$helper->log('Write to CSV format');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
+$writer = IOFactory::createWriter($spreadsheet, 'Csv');
$filename = $helper->getFilename(__FILE__, 'csv');
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/27_Images_Xls.php b/samples/27_Images_Xls.php
index 8fc7bf2b..4923efe2 100644
--- a/samples/27_Images_Xls.php
+++ b/samples/27_Images_Xls.php
@@ -1,10 +1,12 @@
log('Load Xlsx template file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xls');
+$reader = IOFactory::createReader('Xls');
$spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls');
// Save
diff --git a/samples/28_Iterator.php b/samples/28_Iterator.php
index 95bed125..5dbb49e4 100644
--- a/samples/28_Iterator.php
+++ b/samples/28_Iterator.php
@@ -1,16 +1,19 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
$callStartTime = microtime(true);
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load($filename);
$helper->logRead('Xlsx', $filename, $callStartTime);
$helper->log('Iterate worksheets');
diff --git a/samples/29_Advanced_value_binder.php b/samples/29_Advanced_value_binder.php
index 260a612b..7f22c8f0 100644
--- a/samples/29_Advanced_value_binder.php
+++ b/samples/29_Advanced_value_binder.php
@@ -1,5 +1,7 @@
log('Set value binder');
-\PhpOffice\PhpSpreadsheet\Cell::setValueBinder(new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder());
+Cell::setValueBinder(new Cell\AdvancedValueBinder());
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/30_Template.php b/samples/30_Template.php
index ed6f588e..4c6d867b 100644
--- a/samples/30_Template.php
+++ b/samples/30_Template.php
@@ -1,9 +1,12 @@
log('Load from Xls template');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xls');
+$reader = IOFactory::createReader('Xls');
$spreadsheet = $reader->load(__DIR__ . '/templates/30template.xls');
$helper->log('Add new data to the template');
@@ -21,7 +24,7 @@ $data = [['title' => 'Excel for dummies',
],
];
-$spreadsheet->getActiveSheet()->setCellValue('D1', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
+$spreadsheet->getActiveSheet()->setCellValue('D1', Date::PHPToExcel(time()));
$baseRow = 5;
foreach ($data as $r => $dataRow) {
diff --git a/samples/31_Document_properties_write.php b/samples/31_Document_properties_write.php
index 76aeaa62..15936ffa 100644
--- a/samples/31_Document_properties_write.php
+++ b/samples/31_Document_properties_write.php
@@ -1,11 +1,14 @@
load($inputFileName);
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
@@ -18,7 +21,7 @@ $spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document')
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
@@ -28,7 +31,7 @@ $helper->logEndingNotes();
// Reread File
$helper->log('Reread Xlsx file');
-$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheetRead = IOFactory::load($filename);
// Set properties
$helper->log('Get properties');
@@ -53,9 +56,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
foreach ($customProperties as $customProperty) {
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
- if ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
+ if ($propertyType == Properties::PROPERTY_TYPE_DATE) {
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
- } elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
+ } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) {
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
} else {
$formattedValue = $propertyValue;
diff --git a/samples/31_Document_properties_write_xls.php b/samples/31_Document_properties_write_xls.php
index 38f15354..a427be18 100644
--- a/samples/31_Document_properties_write_xls.php
+++ b/samples/31_Document_properties_write_xls.php
@@ -1,11 +1,14 @@
load($inputFileName);
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
@@ -18,7 +21,7 @@ $spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document')
// Save Excel 95 file
$filename = $helper->getFilename(__FILE__, 'xls');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
@@ -28,7 +31,7 @@ $helper->logEndingNotes();
// Reread File
$helper->log('Reread Xls file');
-$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheetRead = IOFactory::load($filename);
// Set properties
$helper->log('Get properties');
@@ -53,9 +56,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
foreach ($customProperties as $customProperty) {
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
- if ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
+ if ($propertyType == Properties::PROPERTY_TYPE_DATE) {
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
- } elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
+ } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) {
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
} else {
$formattedValue = $propertyValue;
diff --git a/samples/32_Chart_read_write.php b/samples/32_Chart_read_write.php
index 2ae0b8ae..6668280c 100644
--- a/samples/32_Chart_read_write.php
+++ b/samples/32_Chart_read_write.php
@@ -1,5 +1,7 @@
log('File ' . $inputFileNameShort . ' does not exist');
continue;
}
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$callStartTime = microtime(true);
$spreadsheet = $reader->load($inputFileName);
@@ -69,7 +71,7 @@ foreach ($inputFileNames as $inputFileName) {
}
$outputFileName = $helper->getFilename($inputFileName);
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+ $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($outputFileName);
diff --git a/samples/32_Chart_read_write_HTML.php b/samples/32_Chart_read_write_HTML.php
index aa697efd..ac2d1e1b 100644
--- a/samples/32_Chart_read_write_HTML.php
+++ b/samples/32_Chart_read_write_HTML.php
@@ -1,14 +1,17 @@
log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
return;
@@ -35,7 +38,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
@@ -83,7 +86,7 @@ foreach ($inputFileNames as $inputFileName) {
// Save
$filename = $helper->getFilename($inputFileName);
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Html');
+ $writer = IOFactory::createWriter($spreadsheet, 'Html');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/32_Chart_read_write_PDF.php b/samples/32_Chart_read_write_PDF.php
index d41f6728..ffd4ba40 100644
--- a/samples/32_Chart_read_write_PDF.php
+++ b/samples/32_Chart_read_write_PDF.php
@@ -1,22 +1,25 @@
log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
return;
@@ -43,7 +46,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
@@ -91,7 +94,7 @@ foreach ($inputFileNames as $inputFileName) {
// Save
$filename = $helper->getFilename($inputFileName);
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf');
+ $writer = IOFactory::createWriter($spreadsheet, 'Pdf');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_area.php b/samples/33_Chart_create_area.php
index 550f8133..76a9f478 100644
--- a/samples/33_Chart_create_area.php
+++ b/samples/33_Chart_create_area.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_AREACHART, // plotType
+ DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,15 +69,15 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test %age-Stacked Area Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -89,7 +97,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_bar.php b/samples/33_Chart_create_bar.php
index 6889956b..96ac5ef7 100644
--- a/samples/33_Chart_create_bar.php
+++ b/samples/33_Chart_create_bar.php
@@ -1,5 +1,6 @@
getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_bar_stacked.php b/samples/33_Chart_create_bar_stacked.php
index f4bb87bc..af9fb542 100644
--- a/samples/33_Chart_create_bar_stacked.php
+++ b/samples/33_Chart_create_bar_stacked.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,18 +69,18 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a horizontal bar rather than a vertical column graph
-$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_BAR);
+$series->setPlotDirection(DataSeries::DIRECTION_BAR);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -92,7 +100,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_column.php b/samples/33_Chart_create_column.php
index 1d4023cf..12903ea6 100644
--- a/samples/33_Chart_create_column.php
+++ b/samples/33_Chart_create_column.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,18 +69,18 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Column Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -92,7 +100,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_column_2.php b/samples/33_Chart_create_column_2.php
index d459dd5b..8ea8d791 100644
--- a/samples/33_Chart_create_column_2.php
+++ b/samples/33_Chart_create_column_2.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -31,9 +39,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- 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'
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 'Budget'
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 'Forecast'
+ new DataSeriesValues('String', 'Worksheet!$E$1', null, 1), // 'Actual'
];
// Set the X-Axis Labels
// Datatype
@@ -43,7 +51,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012
+ new 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 +61,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
+ new DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', null, 12),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -69,19 +77,19 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_BOTTOM, null, false);
+$legend = new Legend(Legend::POSITION_BOTTOM, null, false);
-$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)');
+$title = new Title('Test Grouped Column Chart');
+$xAxisLabel = new Title('Financial Period');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -101,7 +109,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_composite.php b/samples/33_Chart_create_composite.php
index 57abd991..d050a3e9 100644
--- a/samples/33_Chart_create_composite.php
+++ b/samples/33_Chart_create_composite.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -31,13 +39,13 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // Temperature
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // Temperature
];
$dataSeriesLabels2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
];
$dataSeriesLabels3 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // Humidity
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // Humidity
];
// Set the X-Axis Labels
@@ -48,7 +56,7 @@ $dataSeriesLabels3 = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
+ new 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 +67,13 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', null, 12),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', null, 12),
];
// Build the dataseries
-$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
+$series1 = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues, // plotCategory
@@ -73,7 +81,7 @@ $series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series1->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series1->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the Data values for each data series we want to plot
// Datatype
@@ -83,13 +91,13 @@ $series1->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION
// Data values
// Data Marker
$dataSeriesValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
];
// Build the dataseries
-$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series2 = new DataSeries(
+ DataSeries::TYPE_LINECHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
null, // plotCategory
@@ -104,13 +112,13 @@ $series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
// Data values
// Data Marker
$dataSeriesValues3 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
];
// Build the dataseries
-$series3 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series3 = new DataSeries(
+ DataSeries::TYPE_AREACHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels3, // plotLabel
null, // plotCategory
@@ -118,14 +126,14 @@ $series3 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series1, $series2, $series3]);
+$plotArea = new PlotArea(null, [$series1, $series2, $series3]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Average Weather Chart for Crete');
+$title = new Title('Average Weather Chart for Crete');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -145,7 +153,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_line.php b/samples/33_Chart_create_line.php
index 556f9530..b2d6e4f3 100644
--- a/samples/33_Chart_create_line.php
+++ b/samples/33_Chart_create_line.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_LINECHART, // plotType
+ DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,15 +69,15 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stacked Line Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Stacked Line Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -89,7 +97,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_multiple_charts.php b/samples/33_Chart_create_multiple_charts.php
index d8ce1a20..fe20b76d 100644
--- a/samples/33_Chart_create_multiple_charts.php
+++ b/samples/33_Chart_create_multiple_charts.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels1 = [
// Data values
// Data Marker
$xAxisTickValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +53,15 @@ $xAxisTickValues1 = [
// Data values
// Data Marker
$dataSeriesValues1 = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
+$series1 = new DataSeries(
+ DataSeries::TYPE_AREACHART, // plotType
+ DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues1, // plotCategory
@@ -61,15 +69,15 @@ $series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea1 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series1]);
+$plotArea1 = new PlotArea(null, [$series1]);
// Set the chart legend
-$legend1 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend1 = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
-$yAxisLabel1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title1 = new Title('Test %age-Stacked Area Chart');
+$yAxisLabel1 = new Title('Value ($k)');
// Create the chart
-$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart1 = new Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@@ -95,9 +103,9 @@ $worksheet->addChart($chart1);
// Data values
// Data Marker
$dataSeriesLabels2 = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -107,7 +115,7 @@ $dataSeriesLabels2 = [
// Data values
// Data Marker
$xAxisTickValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +125,15 @@ $xAxisTickValues2 = [
// Data values
// Data Marker
$dataSeriesValues2 = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series2 = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
$xAxisTickValues2, // plotCategory
@@ -133,18 +141,18 @@ $series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series2->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series2->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the series in the plot area
-$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series2]);
+$plotArea2 = new PlotArea(null, [$series2]);
// Set the chart legend
-$legend2 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend2 = new Legend(Legend::POSITION_RIGHT, null, false);
-$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
-$yAxisLabel2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title2 = new Title('Test Column Chart');
+$yAxisLabel2 = new Title('Value ($k)');
// Create the chart
-$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart2 = new Chart(
'chart2', // name
$title2, // title
$legend2, // legend
@@ -164,7 +172,7 @@ $worksheet->addChart($chart2);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_pie.php b/samples/33_Chart_create_pie.php
index c8a23909..895e0429 100644
--- a/samples/33_Chart_create_pie.php
+++ b/samples/33_Chart_create_pie.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,7 +31,7 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
];
// Set the X-Axis Labels
// Datatype
@@ -33,7 +41,7 @@ $dataSeriesLabels1 = [
// Data values
// Data Marker
$xAxisTickValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +51,12 @@ $xAxisTickValues1 = [
// Data values
// Data Marker
$dataSeriesValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
];
// Build the dataseries
-$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
+$series1 = new DataSeries(
+ DataSeries::TYPE_PIECHART, // plotType
null, // plotGrouping (Pie charts don't have any grouping)
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
@@ -57,19 +65,19 @@ $series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set up a layout object for the Pie chart
-$layout1 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
+$layout1 = new Chart\Layout();
$layout1->setShowVal(true);
$layout1->setShowPercent(true);
// Set the series in the plot area
-$plotArea1 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout1, [$series1]);
+$plotArea1 = new PlotArea($layout1, [$series1]);
// Set the chart legend
-$legend1 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend1 = new Legend(Legend::POSITION_RIGHT, null, false);
-$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Pie Chart');
+$title1 = new Title('Test Pie Chart');
// Create the chart
-$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart1 = new Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@@ -95,7 +103,7 @@ $worksheet->addChart($chart1);
// Data values
// Data Marker
$dataSeriesLabels2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
];
// Set the X-Axis Labels
// Datatype
@@ -105,7 +113,7 @@ $dataSeriesLabels2 = [
// Data values
// Data Marker
$xAxisTickValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +123,12 @@ $xAxisTickValues2 = [
// Data values
// Data Marker
$dataSeriesValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
];
// Build the dataseries
-$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_DONUTCHART, // plotType
+$series2 = new DataSeries(
+ DataSeries::TYPE_DONUTCHART, // plotType
null, // plotGrouping (Donut charts don't have any grouping)
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
@@ -129,17 +137,17 @@ $series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set up a layout object for the Pie chart
-$layout2 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
+$layout2 = new Chart\Layout();
$layout2->setShowVal(true);
$layout2->setShowCatName(true);
// Set the series in the plot area
-$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout2, [$series2]);
+$plotArea2 = new PlotArea($layout2, [$series2]);
-$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Donut Chart');
+$title2 = new Title('Test Donut Chart');
// Create the chart
-$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart2 = new Chart(
'chart2', // name
$title2, // title
null, // legend
@@ -159,7 +167,7 @@ $worksheet->addChart($chart2);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_radar.php b/samples/33_Chart_create_radar.php
index 2a978792..df81f38c 100644
--- a/samples/33_Chart_create_radar.php
+++ b/samples/33_Chart_create_radar.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -31,8 +39,8 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -42,8 +50,8 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
+ new 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 +61,13 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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 DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_RADARCHART, // plotType
+$series = new DataSeries(
+ DataSeries::TYPE_RADARCHART, // plotType
null, // plotGrouping (Radar charts don't have any grouping)
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@@ -67,21 +75,21 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
$dataSeriesValues, // plotValues
null, // plotDirection
null, // smooth line
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_MARKER // plotStyle
+ DataSeries::STYLE_MARKER // plotStyle
);
// Set up a layout object for the Pie chart
-$layout = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
+$layout = new Chart\Layout();
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout, [$series]);
+$plotArea = new PlotArea($layout, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Radar Chart');
+$title = new Title('Test Radar Chart');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -101,7 +109,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_scatter.php b/samples/33_Chart_create_scatter.php
index 205113ab..df5564d7 100644
--- a/samples/33_Chart_create_scatter.php
+++ b/samples/33_Chart_create_scatter.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,13 +31,13 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new 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 +47,14 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
+$series = new DataSeries(
+ DataSeries::TYPE_SCATTERCHART, // plotType
null, // plotGrouping (Scatter charts don't have any grouping)
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@@ -54,19 +62,19 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
$dataSeriesValues, // plotValues
null, // plotDirection
null, // smooth line
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
+ DataSeries::STYLE_LINEMARKER // plotStyle
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Scatter Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Scatter Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -86,7 +94,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_stock.php b/samples/33_Chart_create_stock.php
index eea2a430..78d16e3f 100644
--- a/samples/33_Chart_create_stock.php
+++ b/samples/33_Chart_create_stock.php
@@ -1,9 +1,18 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -18,7 +27,7 @@ $worksheet->fromArray(
'A1',
true
);
-$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_00);
+$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER_00);
// Set the Labels for each data series we want to plot
// Datatype
@@ -28,10 +37,10 @@ $worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSp
// Data values
// Data Marker
$dataSeriesLabels = [
- 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
+ new DataSeriesValues('String', 'Worksheet!$B$1', null, 1), //Max / Open
+ new DataSeriesValues('String', 'Worksheet!$C$1', null, 1), //Min / Close
+ new DataSeriesValues('String', 'Worksheet!$D$1', null, 1), //Min Threshold / Min
+ new DataSeriesValues('String', 'Worksheet!$E$1', null, 1), //Max Threshold / Max
];
// Set the X-Axis Labels
// Datatype
@@ -41,7 +50,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$6', null, 5), // Counts
+ new 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 +60,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- 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),
+ new DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', null, 5),
+ new DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', null, 5),
+ new DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', null, 5),
+ new DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', null, 5),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_STOCKCHART, // plotType
+$series = new DataSeries(
+ 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 +77,16 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stock Chart');
-$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Counts');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Values');
+$title = new Title('Test Stock Chart');
+$xAxisLabel = new Title('Counts');
+$yAxisLabel = new Title('Values');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'stock-chart', // name
$title, // title
$legend, // legend
@@ -97,7 +106,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/34_Chart_update.php b/samples/34_Chart_update.php
index 0a3c6e5a..bed5241d 100644
--- a/samples/34_Chart_update.php
+++ b/samples/34_Chart_update.php
@@ -1,16 +1,18 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$writer->save($filename);
$helper->log('Load from Xlsx file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($filename);
@@ -29,7 +31,7 @@ $worksheet->fromArray(
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/35_Chart_render.php b/samples/35_Chart_render.php
index b472f206..a63b28ef 100644
--- a/samples/35_Chart_render.php
+++ b/samples/35_Chart_render.php
@@ -1,14 +1,17 @@
log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
return;
@@ -35,7 +38,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file ", $inputFileNameShort);
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
diff --git a/samples/37_Page_layout_view.php b/samples/37_Page_layout_view.php
index 42cc1beb..2cdb3e12 100644
--- a/samples/37_Page_layout_view.php
+++ b/samples/37_Page_layout_view.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -23,7 +26,7 @@ $spreadsheet->setActiveSheetIndex(0)
->setCellValue('B2', 'world!');
// Set the page layout view as page layout
-$spreadsheet->getActiveSheet()->getSheetView()->setView(\PhpOffice\PhpSpreadsheet\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT);
+$spreadsheet->getActiveSheet()->getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT);
// Save
$helper->write($spreadsheet, __FILE__);
diff --git a/samples/38_Clone_worksheet.php b/samples/38_Clone_worksheet.php
index aa555c39..b55b9025 100644
--- a/samples/38_Clone_worksheet.php
+++ b/samples/38_Clone_worksheet.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/39_Dropdown.php b/samples/39_Dropdown.php
index d4c0306e..bb68c3e9 100644
--- a/samples/39_Dropdown.php
+++ b/samples/39_Dropdown.php
@@ -1,10 +1,14 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -39,7 +43,7 @@ foreach ($continents as $key => $filename) {
$spreadsheet->getActiveSheet()
->fromArray($countries, null, $column . '1');
$spreadsheet->addNamedRange(
- new \PhpOffice\PhpSpreadsheet\NamedRange(
+ new NamedRange(
$continent,
$spreadsheet->getActiveSheet(),
$column . '1:' . $column . $countryCount
@@ -61,7 +65,7 @@ $spreadsheet->getActiveSheet()
->setVisible(false);
$spreadsheet->addNamedRange(
- new \PhpOffice\PhpSpreadsheet\NamedRange(
+ new NamedRange(
'Continents',
$spreadsheet->getActiveSheet(),
$continentColumn . '1:' . $continentColumn . count($continents)
@@ -85,8 +89,8 @@ $spreadsheet->getActiveSheet()
$validation = $spreadsheet->getActiveSheet()
->getCell('B1')
->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
- ->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
+$validation->setType(DataValidation::TYPE_LIST)
+ ->setErrorStyle(DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
@@ -106,8 +110,8 @@ $spreadsheet->getActiveSheet()
$validation = $spreadsheet->getActiveSheet()
->getCell('B3')
->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
- ->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
+$validation->setType(DataValidation::TYPE_LIST)
+ ->setErrorStyle(DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
diff --git a/samples/40_Duplicate_style.php b/samples/40_Duplicate_style.php
index dca84817..4a006f90 100644
--- a/samples/40_Duplicate_style.php
+++ b/samples/40_Duplicate_style.php
@@ -1,15 +1,19 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$helper->log('Create styles array');
$styles = [];
for ($i = 0; $i < 10; ++$i) {
- $style = new \PhpOffice\PhpSpreadsheet\Style();
+ $style = new Style();
$style->getFont()->setSize($i + 4);
$styles[] = $style;
}
@@ -20,7 +24,7 @@ for ($col = 0; $col < 50; ++$col) {
for ($row = 0; $row < 100; ++$row) {
$str = ($row + $col);
$style = $styles[$row % 10];
- $coord = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col) . ($row + 1);
+ $coord = Cell::stringFromColumnIndex($col) . ($row + 1);
$worksheet->setCellValue($coord, $str);
$worksheet->duplicateStyle($style, $coord);
}
diff --git a/samples/42_RichText.php b/samples/42_RichText.php
index 53b1c573..88db805c 100644
--- a/samples/42_RichText.php
+++ b/samples/42_RichText.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +51,7 @@ $html4 = 'H2SO4 is the chemical formula for Sulphuric acid
$html5 = 'bold, italic, bold+italic';
-$wizard = new \PhpOffice\PhpSpreadsheet\Helper\Html();
+$wizard = new HtmlHelper();
$richText = $wizard->toRichTextObject($html1);
$spreadsheet->getActiveSheet()
diff --git a/samples/43_Merge_workbooks.php b/samples/43_Merge_workbooks.php
index 6173a2d5..57721a4a 100644
--- a/samples/43_Merge_workbooks.php
+++ b/samples/43_Merge_workbooks.php
@@ -1,17 +1,19 @@
log('Load MergeBook1 from Xlsx file');
$filename1 = __DIR__ . '/templates/43mergeBook1.xlsx';
$callStartTime = microtime(true);
-$spreadsheet1 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename1);
+$spreadsheet1 = IOFactory::load($filename1);
$helper->logRead('Xlsx', $filename1, $callStartTime);
$helper->log('Load MergeBook2 from Xlsx file');
$filename2 = __DIR__ . '/templates/43mergeBook2.xlsx';
$callStartTime = microtime(true);
-$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename2);
+$spreadsheet2 = IOFactory::load($filename2);
$helper->logRead('Xlsx', $filename2, $callStartTime);
foreach ($spreadsheet2->getSheetNames() as $sheetName) {
diff --git a/samples/44_Worksheet_info.php b/samples/44_Worksheet_info.php
index 71849ca4..cacb9ae6 100644
--- a/samples/44_Worksheet_info.php
+++ b/samples/44_Worksheet_info.php
@@ -1,15 +1,18 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$writer->save($filename);
-$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$inputFileType = IOFactory::identify($filename);
+$reader = IOFactory::createReader($inputFileType);
$sheetList = $reader->listWorksheetNames($filename);
$sheetInfo = $reader->listWorksheetInfo($filename);
diff --git a/samples/45_Quadratic_equation_solver.php b/samples/45_Quadratic_equation_solver.php
index f5e11e47..39f6685d 100644
--- a/samples/45_Quadratic_equation_solver.php
+++ b/samples/45_Quadratic_equation_solver.php
@@ -1,4 +1,6 @@