Fix sample which does't work (#123)

This commit is contained in:
tsmsogn 2017-03-24 22:09:32 +09:00 committed by Adrien Crivelli
parent 2e24a1e1b4
commit 0f0de914f4
39 changed files with 150 additions and 280 deletions

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Returns the average of selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Counts the cells that contain numbers in a database.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Extracts a single value from a column of a list or database that matches conditions that you specify.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Returns the maximum value from selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
require_once __DIR__ . '/../../../../src/Bootstrap.php';
// Create new PhpSpreadsheet object
$spreadsheet = new PHPExcel();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Returns the minimum value from selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
require_once __DIR__ . '/../../../../src/Bootstrap.php';
// Create new PhpSpreadsheet object
$spreadsheet = new PHPExcel();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Multiplies the values in a column of a list or database that match conditions that you specify.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
require_once __DIR__ . '/../../../../src/Bootstrap.php';
// Create new PhpSpreadsheet object
$spreadsheet = new PHPExcel();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Estimates the standard deviation based on a sample of selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
require_once __DIR__ . '/../../../../src/Bootstrap.php';
// Create new PhpSpreadsheet object
$spreadsheet = new PHPExcel();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Calculates the standard deviation based on the entire population of selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
require_once __DIR__ . '/../../../../src/Bootstrap.php';
// Create new PhpSpreadsheet object
$spreadsheet = new PHPExcel();
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Estimates variance based on a sample from selected database entries.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PhpSpreadsheet */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PhpSpreadsheet();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -10,7 +10,7 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
<title>PhpSpreadsheet Calculation Examples</title>
</head>
<body>
@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Calculates variance based on the entire population of selected database entries,</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data

View File

@ -10,7 +10,7 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
<title>PhpSpreadsheet Calculation Examples</title>
</head>
<body>
@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Returns the serial number of a particular date.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data
@ -76,4 +72,6 @@ echo '<hr />';
echo '</tr>';
}
?>
</table>
</table>
</body>
</html>

View File

@ -10,7 +10,7 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
<title>PhpSpreadsheet Calculation Examples</title>
</head>
<body>
@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Converts a date in the form of text to a serial number.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data
@ -51,7 +47,7 @@ echo '<hr />';
// Test the formulae
?>
<p><strong>Warning: </strong>The PHPExcel DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.</p>
<p><strong>Warning: </strong>The PhpSpreadsheet DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.</p>
<table border="1" cellspacing="0">
<tr>
<th>Date String</th>
@ -69,4 +65,6 @@ echo '<hr />';
echo '</tr>';
}
?>
</table>
</table>
</body>
</html>

View File

@ -10,7 +10,7 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
<title>PhpSpreadsheet Calculation Examples</title>
</head>
<body>
@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Returns the serial number of a particular time.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data
@ -74,4 +70,6 @@ echo '<hr />';
echo '</tr>';
}
?>
</table>
</table>
</body>
</html>

View File

@ -10,7 +10,7 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Examples</title>
<title>PhpSpreadsheet Calculation Examples</title>
</head>
<body>
@ -19,14 +19,10 @@ date_default_timezone_set('Europe/London');
<h2>Converts a time in the form of text to a serial number.</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../../Classes/');
require_once __DIR__ . '/../../../../src/Bootstrap.php';
/** Include PHPExcel */
include 'PHPExcel.php';
// Create new PHPExcel object
$spreadsheet = new PHPExcel();
// Create new PhpSpreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
// Add some data
@ -65,4 +61,6 @@ echo '<hr />';
echo '</tr>';
}
?>
</table>
</table>
</body>
</html>

View File

@ -10,14 +10,14 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Calculation Function Examples</title>
<title>PhpSpreadsheet Calculation Function Examples</title>
</head>
<body>
<?php
echo '<h1>PHPExcel Calculation Function Examples</h1>';
echo '<h1>PhpSpreadsheet Calculation Function Examples</h1>';
$exampleTypeList = glob('./*', GLOB_ONLYDIR);

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #01</title>
<title>PhpSpreadsheet Reader Example #01</title>
</head>
<body>
<h1>PHPExcel Reader Example #01</h1>
<h1>PhpSpreadsheet Reader Example #01</h1>
<h2>Simple File Reader using \PhpOffice\PhpSpreadsheet\IOFactory::load()</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileName = './sampleData/example1.xls';
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />';

View File

@ -5,23 +5,19 @@ set_time_limit(0);
date_default_timezone_set('Europe/London');
/* Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #02</title>
<title>PhpSpreadsheet Reader Example #02</title>
</head>
<body>
<h1>PHPExcel Reader Example #02</h1>
<h1>PhpSpreadsheet Reader Example #02</h1>
<h2>Simple File Reader using a Specified Reader</h2>
<?php

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #03</title>
<title>PhpSpreadsheet Reader Example #03</title>
</head>
<body>
<h1>PHPExcel Reader Example #03</h1>
<h1>PhpSpreadsheet Reader Example #03</h1>
<h2>Simple File Reader using the \PhpOffice\PhpSpreadsheet\IOFactory to Return a Reader</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #04</title>
<title>PhpSpreadsheet Reader Example #04</title>
</head>
<body>
<h1>PHPExcel Reader Example #04</h1>
<h1>PhpSpreadsheet Reader Example #04</h1>
<h2>Simple File Reader using the \PhpOffice\PhpSpreadsheet\IOFactory to Identify a Reader to Use</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileName = './sampleData/example1.xls';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #05</title>
<title>PhpSpreadsheet Reader Example #05</title>
</head>
<body>
<h1>PHPExcel Reader Example #05</h1>
<h1>PhpSpreadsheet Reader Example #05</h1>
<h2>Simple File Reader using the "Read Data Only" Option</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #06</title>
<title>PhpSpreadsheet Reader Example #06</title>
</head>
<body>
<h1>PHPExcel Reader Example #06</h1>
<h1>PhpSpreadsheet Reader Example #06</h1>
<h2>Simple File Reader Loading All WorkSheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #07</title>
<title>PhpSpreadsheet Reader Example #07</title>
</head>
<body>
<h1>PHPExcel Reader Example #07</h1>
<h1>PhpSpreadsheet Reader Example #07</h1>
<h2>Simple File Reader Loading a Single Named WorkSheet</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #08</title>
<title>PhpSpreadsheet Reader Example #08</title>
</head>
<body>
<h1>PHPExcel Reader Example #08</h1>
<h1>PhpSpreadsheet Reader Example #08</h1>
<h2>Simple File Reader Loading Several Named WorkSheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #09</title>
<title>PhpSpreadsheet Reader Example #09</title>
</head>
<body>
<h1>PHPExcel Reader Example #09</h1>
<h1>PhpSpreadsheet Reader Example #09</h1>
<h2>Simple File Reader Using a Read Filter</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #10</title>
<title>PhpSpreadsheet Reader Example #10</title>
</head>
<body>
<h1>PHPExcel Reader Example #10</h1>
<h1>PhpSpreadsheet Reader Example #10</h1>
<h2>Simple File Reader Using a Configurable Read Filter</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #11</title>
<title>PhpSpreadsheet Reader Example #11</title>
</head>
<body>
<h1>PHPExcel Reader Example #11</h1>
<h1>PhpSpreadsheet Reader Example #11</h1>
<h2>Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 1)</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';
@ -78,7 +74,7 @@ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
$chunkFilter = new chunkReadFilter($startRow, $chunkSize);
/* Tell the Reader that we want to use the new Read Filter that we've just Instantiated **/
$reader->setReadFilter($chunkFilter);
/* Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
/* Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object **/
$spreadsheet = $reader->load($inputFileName);
// Do some processing here

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #12</title>
<title>PhpSpreadsheet Reader Example #12</title>
</head>
<body>
<h1>PHPExcel Reader Example #12</h1>
<h1>PhpSpreadsheet Reader Example #12</h1>
<h2>Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 2)</h2>
<?php
/** Set Include path to point at the PHPExcel Classes folder **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** Include \PhpOffice\PhpSpreadsheet\IOFactory **/
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';
@ -81,7 +77,7 @@ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), '<br />';
/* Tell the Read Filter, the limits on which rows we want to read this iteration **/
$chunkFilter->setRows($startRow, $chunkSize);
/* Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
/* Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object **/
$spreadsheet = $reader->load($inputFileName);
// Do some processing here

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #13</title>
<title>PhpSpreadsheet Reader Example #13</title>
</head>
<body>
<h1>PHPExcel Reader Example #13</h1>
<h1>PhpSpreadsheet Reader Example #13</h1>
<h2>Simple File Reader for Multiple CSV Files</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Csv';
$inputFileNames = ['./sampleData/example1.csv', './sampleData/example2.csv'];

View File

@ -1,24 +1,25 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #15</title>
<title>PhpSpreadsheet Reader Example #14</title>
</head>
<body>
<h1>PHPExcel Reader Example #14</h1>
<h1>PhpSpreadsheet Reader Example #14</h1>
<h2>Reading a Large CSV file in "Chunks" to split across multiple Worksheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Csv';
$inputFileName = './sampleData/example2.csv';
@ -69,8 +70,8 @@ $chunkFilter = new chunkReadFilter();
$reader->setReadFilter($chunkFilter)
->setContiguous(true);
/* Instantiate a new PHPExcel object manually **/
$spreadsheet = new PHPExcel();
/* Instantiate a new PhpSpreadsheet object manually **/
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
/* Set a sheet index **/
$sheet = 0;
@ -83,7 +84,7 @@ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
/* Increment the worksheet index pointer for the Reader **/
$reader->setSheetIndex($sheet);
/* Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/
/* Load only the rows that match our filter into a new worksheet in the PhpSpreadsheet Object **/
$reader->loadIntoExisting($inputFileName, $spreadsheet);
/* Set the worksheet title (to reference the "sheet" of data that we've loaded) **/
/* and increment the sheet index as well **/

View File

@ -1,24 +1,25 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #15</title>
<title>PhpSpreadsheet Reader Example #15</title>
</head>
<body>
<h1>PHPExcel Reader Example #15</h1>
<h1>PhpSpreadsheet Reader Example #15</h1>
<h2>Simple File Reader for Tab-Separated Value File using the Advanced Value Binder</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
\PhpOffice\PhpSpreadsheet\Cell::setValueBinder(new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder());

View File

@ -10,26 +10,22 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #16</title>
<title>PhpSpreadsheet Reader Example #16</title>
</head>
<body>
<h1>PHPExcel Reader Example #16</h1>
<h1>PhpSpreadsheet Reader Example #16</h1>
<h2>Handling Loader Exceptions using Try/Catch</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileName = './sampleData/example_1.xls';
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
try {
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
} catch (\PHPExcel\Reader\Exception $e) {
} catch (\InvalidArgumentException $e) {
die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
}

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #17</title>
<title>PhpSpreadsheet Reader Example #17</title>
</head>
<body>
<h1>PHPExcel Reader Example #17</h1>
<h1>PhpSpreadsheet Reader Example #17</h1>
<h2>Simple File Reader Loading Several Named WorkSheets</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #18</title>
<title>PhpSpreadsheet Reader Example #18</title>
</head>
<body>
<h1>PHPExcel Reader Example #18</h1>
<h1>PhpSpreadsheet Reader Example #18</h1>
<h2>Reading list of WorkSheets without loading entire file</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,20 +10,16 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reader Example #19</title>
<title>PhpSpreadsheet Reader Example #19</title>
</head>
<body>
<h1>PHPExcel Reader Example #19</h1>
<h1>PhpSpreadsheet Reader Example #19</h1>
<h2>Reading WorkSheet information without loading entire file</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
// $inputFileType = 'Xlsx';

View File

@ -10,27 +10,23 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #01</title>
<title>PhpSpreadsheet Reading WorkBook Data Example #01</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #01</h1>
<h1>PhpSpreadsheet Reading WorkBook Data Example #01</h1>
<h2>Read the WorkBook Properties</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
$inputFileName = './sampleData/example1.xls';
/* Create a new Reader of the type defined in $inputFileType **/
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
/* Load $inputFileName to a PHPExcel Object **/
/* Load $inputFileName to a PhpSpreadsheet Object **/
$spreadsheet = $reader->load($inputFileName);
echo '<hr />';

View File

@ -10,27 +10,23 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #02</title>
<title>PhpSpreadsheet Reading WorkBook Data Example #02</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #02</h1>
<h1>PhpSpreadsheet Reading WorkBook Data Example #02</h1>
<h2>Read a list of Custom Properties for a WorkBook</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xlsx';
$inputFileName = './sampleData/example1.xlsx';
/* Create a new Reader of the type defined in $inputFileType **/
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
/* Load $inputFileName to a PHPExcel Object **/
/* Load $inputFileName to a PhpSpreadsheet Object **/
$spreadsheet = $reader->load($inputFileName);
echo '<hr />';

View File

@ -10,27 +10,23 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #03</title>
<title>PhpSpreadsheet Reading WorkBook Data Example #03</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #03</h1>
<h1>PhpSpreadsheet Reading WorkBook Data Example #03</h1>
<h2>Read Custom Property Values for a WorkBook</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xlsx';
$inputFileName = './sampleData/example1.xlsx';
/* Create a new Reader of the type defined in $inputFileType **/
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
/* Load $inputFileName to a PHPExcel Object **/
/* Load $inputFileName to a PhpSpreadsheet Object **/
$spreadsheet = $reader->load($inputFileName);
echo '<hr />';

View File

@ -10,38 +10,34 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Reading WorkBook Data Example #04</title>
<title>PhpSpreadsheet Reading WorkBook Data Example #04</title>
</head>
<body>
<h1>PHPExcel Reading WorkBook Data Example #04</h1>
<h1>PhpSpreadsheet Reading WorkBook Data Example #04</h1>
<h2>Get a List of the Worksheets in a WorkBook</h2>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** \PhpOffice\PhpSpreadsheet\IOFactory */
include 'PHPExcel/IOFactory.php';
require_once __DIR__ . '/../../../src/Bootstrap.php';
$inputFileType = 'Xls';
$inputFileName = './sampleData/example2.xls';
/* Create a new Reader of the type defined in $inputFileType **/
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
/* Load $inputFileName to a PHPExcel Object **/
/* Load $inputFileName to a PhpSpreadsheet Object **/
$spreadsheet = $reader->load($inputFileName);
echo '<hr />';
echo 'Reading the number of Worksheets in the WorkBook<br />';
/* Use the PHPExcel object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */
/* Use the PhpSpreadsheet object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */
$sheetCount = $spreadsheet->getSheetCount();
echo 'There ',(($sheetCount == 1) ? 'is' : 'are'),' ',$sheetCount,' WorkSheet',(($sheetCount == 1) ? '' : 's'),' in the WorkBook<br /><br />';
echo 'Reading the names of Worksheets in the WorkBook<br />';
/* Use the PHPExcel object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */
/* Use the PhpSpreadsheet object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */
$sheetNames = $spreadsheet->getSheetNames();
foreach ($sheetNames as $sheetIndex => $sheetName) {
echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"<br />';

View File

@ -10,7 +10,7 @@ date_default_timezone_set('Europe/London');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Examples</title>
<title>PhpSpreadsheet Examples</title>
</head>
<body>
@ -20,7 +20,7 @@ date_default_timezone_set('Europe/London');
$exampleTypeList = glob('./*', GLOB_ONLYDIR);
foreach ($exampleTypeList as $exampleType) {
echo '<h1>PHPExcel ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples</h1>';
echo '<h1>PhpSpreadsheet ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples</h1>';
$exampleList = glob('./' . $exampleType . '/*.php');