parent
2b41bdbf4e
commit
39b55ded30
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -29,6 +29,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- c:max and c:min elements shall NOT be inside c:orientation elements - @vitalyrepin [#869](https://github.com/PHPOffice/PHPExcel/pull/869)
|
||||
- Implement actual timezone adjustment into PHPExcel_Shared_Date::PHPToExcel - @sim642 [#489](https://github.com/PHPOffice/PHPExcel/pull/489)
|
||||
|
||||
### BREAKING CHANGE
|
||||
|
||||
- Introduction of namespaces for all classes, eg: `PHPExcel_Calculation_Function` becomes `PhpOffice\PhpSpreadsheet\Calculation\Functions`
|
||||
- Some classes were renamed for clarity and/or consistency:
|
||||
|
||||
| Before | After |
|
||||
|---------------------------------|-------------------------------------------|
|
||||
| `PHPExcel` | `PhpOffice\PhpSpreadsheet\Spreadsheet` |
|
||||
| `PHPExcel_Reader_Excel2007` | `PhpOffice\PhpSpreadsheet\Reader\Xlsx` |
|
||||
| `PHPExcel_Writer_Excel2007` | `PhpOffice\PhpSpreadsheet\Writer\Xlsx` |
|
||||
|
||||
- Some methods were renamed for clarity and/or consistency:
|
||||
|
||||
| Before | After |
|
||||
|--------------------------------------------------|------------------------------------------------------------|
|
||||
| `PHPExcel_Calculation_DateTime::DAYOFWEEK()` | `PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY()` |
|
||||
| `PHPExcel_Calculation_DateTime::WEEKOFYEAR()` | `PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM()` |
|
||||
| `PHPExcel_Calculation_DateTime::MINUTEOFHOUR()` | `PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE()` |
|
||||
| `PHPExcel_Calculation_DateTime::SECONDOFMINUTE()`| `PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND()` |
|
||||
|
||||
|
||||
## [1.8.1] - 2015-04-30
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'SYLK';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
|
|
|
@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
|||
include 'PHPExcel/IOFactory.php';
|
||||
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileName = './sampleData/example1.xlsx';
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
|
|
|
@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
|
|||
include 'PHPExcel/IOFactory.php';
|
||||
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileName = './sampleData/example1.xlsx';
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
|
|
|
@ -6,6 +6,6 @@ The up-to-date F.A.Q. page for PHPExcel can be found on [http://www.codeplex.com
|
|||
|
||||
### Formulas don’t seem to be calculated in Excel2003 using compatibility pack?
|
||||
|
||||
This is normal behaviour of the compatibility pack, Excel2007 displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
|
||||
This is normal behaviour of the compatibility pack, Xlsx displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
|
||||
|
||||
[1]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements
|
||||
|
|
|
@ -299,7 +299,7 @@ DATEVALUE uses the php date/time object implementation of strtotime() (which can
|
|||
|
||||
__WARNING:-__ PHPExcel accepts a wider range of date formats than MS Excel, so it is entirely possible that Excel will return a #VALUE! error when passed a date string that it can’t interpret, while PHPExcel is able to translate that same string into a correct date value.
|
||||
|
||||
Care should be taken in workbooks that use string formatted dates in calculations when writing to Excel5 or Excel2007.
|
||||
Care should be taken in workbooks that use string formatted dates in calculations when writing to Excel5 or Xlsx.
|
||||
|
||||
#### DAY
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
## Autofilter Expressions
|
||||
|
||||
PHPEXcel 1.7.8 introduced the ability to actually create, read and write filter expressions; initially only for Excel2007 files, but later releases will extend this to other formats.
|
||||
PHPEXcel 1.7.8 introduced the ability to actually create, read and write filter expressions; initially only for Xlsx files, but later releases will extend this to other formats.
|
||||
|
||||
To apply a filter expression to an autoFilter range, you first need to identify which column you're going to be applying this filter to.
|
||||
|
||||
|
|
|
@ -73,19 +73,19 @@ It is necessary to use UTF-8 encoding for all texts in PHPExcel. If the script u
|
|||
|
||||
Make sure you meet all requirements, especially php_zip extension should be enabled.
|
||||
|
||||
The ZipArchive class is only required when reading or writing formats that use Zip compression (Excel2007 and OOCalc). Since version 1.7.6 the PCLZip library has been bundled with PHPExcel as an alternative to the ZipArchive class.
|
||||
The ZipArchive class is only required when reading or writing formats that use Zip compression (Xlsx and OOCalc). Since version 1.7.6 the PCLZip library has been bundled with PHPExcel as an alternative to the ZipArchive class.
|
||||
|
||||
This can be enabled by calling:
|
||||
```php
|
||||
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
|
||||
```
|
||||
*before* calling the save method of the Excel2007 Writer.
|
||||
*before* calling the save method of the Xlsx Writer.
|
||||
|
||||
You can revert to using ZipArchive by calling:
|
||||
```php
|
||||
PHPExcel_Settings::setZipClass(PHPExcel_Settings::ZIPARCHIVE);
|
||||
```
|
||||
At present, this only allows you to write Excel2007 files without the need for ZipArchive (not to read Excel2007 or OOCalc)
|
||||
At present, this only allows you to write Xlsx files without the need for ZipArchive (not to read Xlsx or OOCalc)
|
||||
|
||||
##### Excel 2007 cannot open the file generated by PHPExcel_Writer_2007 on Windows
|
||||
|
||||
|
@ -95,7 +95,7 @@ Some older versions of the 5.2.x php_zip extension on Windows contain an error w
|
|||
|
||||
Alternatively, upgrading to at least PHP 5.2.9 should solve the problem.
|
||||
|
||||
If you can't locate a clean copy of ZipArchive, then you can use the PCLZip library as an alternative when writing Excel2007 files, as described above.
|
||||
If you can't locate a clean copy of ZipArchive, then you can use the PCLZip library as an alternative when writing Xlsx files, as described above.
|
||||
|
||||
##### Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate yyy bytes) in zzz on line aaa
|
||||
|
||||
|
@ -122,7 +122,7 @@ We are slowly building up a list of features, together with the different reader
|
|||
|
||||
##### Formulas don't seem to be calculated in Excel2003 using compatibility pack?
|
||||
|
||||
This is normal behaviour of the compatibility pack, Excel2007 displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
|
||||
This is normal behaviour of the compatibility pack, Xlsx displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
|
||||
|
||||
##### Setting column width is not 100% accurate
|
||||
|
||||
|
@ -177,5 +177,5 @@ Thanks to peterrlynch for the following advice on resolving issues between the [
|
|||
[21]: http://journal.mycom.co.jp/articles/2009/03/06/phpexcel/index.html
|
||||
|
||||
|
||||
[^phpzip_footnote]: __php_zip__ is only needed by __PHPExcel_Reader_Excel2007__, __PHPExcel_Writer_Excel2007__ and __PHPExcel_Reader_OOCalc__. In other words, if you need PHPExcel to handle .xlsx or .ods files you will need the zip extension, but otherwise not.<br />You can remove this dependency for writing Excel2007 files (though not yet for reading) by using the PCLZip library that is bundled with PHPExcel. See the FAQ section of this document for details about this. PCLZip does have a dependency on PHP's zlib extension being enabled.
|
||||
[^phpzip_footnote]: __php_zip__ is only needed by __PHPExcel_Reader_Excel2007__, __PHPExcel_Writer_Excel2007__ and __PHPExcel_Reader_OOCalc__. In other words, if you need PHPExcel to handle .xlsx or .ods files you will need the zip extension, but otherwise not.<br />You can remove this dependency for writing Xlsx files (though not yet for reading) by using the PCLZip library that is bundled with PHPExcel. See the FAQ section of this document for details about this. PCLZip does have a dependency on PHP's zlib extension being enabled.
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ $objPHPExcel->getActiveSheet()->getStyle('A10')
|
|||
![07-simple-example-1.png](./images/07-simple-example-1.png "")
|
||||
|
||||
|
||||
**Note** that not all complex format masks such as this one will work when retrieving a formatted value to display "on screen", or for certain writers such as HTML or PDF, but it will work with the true spreadsheet writers (Excel2007 and Excel5).
|
||||
**Note** that not all complex format masks such as this one will work when retrieving a formatted value to display "on screen", or for certain writers such as HTML or PDF, but it will work with the true spreadsheet writers (Xlsx and Excel5).
|
||||
|
||||
### Setting a range of cells from an array
|
||||
|
||||
|
@ -266,7 +266,7 @@ The easiest way to loop cells is by using iterators. Using iterators, one can us
|
|||
Below is an example where we read all the values in a worksheet and display them in a table.
|
||||
|
||||
```php
|
||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
||||
$objReader = PHPExcel_IOFactory::createReader('Xlsx');
|
||||
$objReader->setReadDataOnly(TRUE);
|
||||
$objPHPExcel = $objReader->load("test.xlsx");
|
||||
|
||||
|
@ -304,7 +304,7 @@ Note: In PHPExcel column index is 0-based while row index is 1-based. That means
|
|||
Below is an example where we read all the values in a worksheet and display them in a table.
|
||||
|
||||
```php
|
||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
||||
$objReader = PHPExcel_IOFactory::createReader('Xlsx');
|
||||
$objReader->setReadDataOnly(TRUE);
|
||||
$objPHPExcel = $objReader->load("test.xlsx");
|
||||
|
||||
|
@ -331,7 +331,7 @@ echo '</table>' . PHP_EOL;
|
|||
Alternatively, you can take advantage of PHP's "Perl-style" character incrementors to loop through the cells by coordinate:
|
||||
|
||||
```php
|
||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
||||
$objReader = PHPExcel_IOFactory::createReader('Xlsx');
|
||||
$objReader->setReadDataOnly(TRUE);
|
||||
$objPHPExcel = $objReader->load("test.xlsx");
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ The first occurrence of the following codes turns the formatting ON, the second
|
|||
|
||||
Superscript and subscript cannot both be ON at same time. Whichever comes first wins and the other is ignored, while the first is ON.
|
||||
|
||||
The following codes are supported by Excel2007:
|
||||
The following codes are supported by Xlsx:
|
||||
|
||||
Code | Meaning
|
||||
-----------------------|-----------
|
||||
|
@ -545,10 +545,10 @@ $objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()
|
|||
__Tip__
|
||||
The rules for composing a number format code in Excel can be rather complicated. Sometimes you know how to create some number format in Microsoft Office Excel, but don't know what the underlying number format code looks like. How do you find it?
|
||||
|
||||
The readers shipped with PHPExcel come to the rescue. Load your template workbook using e.g. Excel2007 reader to reveal the number format code. Example how read a number format code for cell A1:
|
||||
The readers shipped with PHPExcel come to the rescue. Load your template workbook using e.g. Xlsx reader to reveal the number format code. Example how read a number format code for cell A1:
|
||||
|
||||
```php
|
||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
||||
$objReader = PHPExcel_IOFactory::createReader('Xlsx');
|
||||
$objPHPExcel = $objReader->load('template.xlsx');
|
||||
var_dump($objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->getFormatCode());
|
||||
```
|
||||
|
@ -745,7 +745,7 @@ $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
|
|||
|
||||
### Setting data validation on a cell
|
||||
|
||||
Data validation is a powerful feature of Excel2007. It allows to specify an input filter on the data that can be inserted in a specific cell. This filter can be a range (i.e. value must be between 0 and 10), a list (i.e. value must be picked from a list), ...
|
||||
Data validation is a powerful feature of Xlsx. It allows to specify an input filter on the data that can be inserted in a specific cell. This filter can be a range (i.e. value must be between 0 and 10), a list (i.e. value must be picked from a list), ...
|
||||
|
||||
The following piece of code only allows numbers between 10 and 20 to be entered in cell B3:
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetm
|
|||
header('Content-Disposition: attachment;filename="myfile.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Xlsx');
|
||||
$objWriter->save('php://output');
|
||||
```
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ $objReader->load("05featuredemo.xlsx");
|
|||
You can create a PHPExcel_Reader_IReader instance using PHPExcel_IOFactory in explicit mode using the following code sample:
|
||||
|
||||
```php
|
||||
$objReader = PHPExcel_IOFactory::createReader("Excel2007");
|
||||
$objReader = PHPExcel_IOFactory::createReader("Xlsx");
|
||||
$objPHPExcel = $objReader->load("05featuredemo.xlsx");
|
||||
```
|
||||
|
||||
|
@ -46,13 +46,13 @@ Note that automatic type resolving mode is slightly slower than explicit mode.
|
|||
You can create a PHPExcel_Writer_Iwriter instance using PHPExcel_IOFactory:
|
||||
|
||||
```php
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Xlsx");
|
||||
$objWriter->save("05featuredemo.xlsx");
|
||||
```
|
||||
|
||||
### Excel 2007 (SpreadsheetML) file format
|
||||
|
||||
Excel2007 file format is the main file format of PHPExcel. It allows outputting the in-memory spreadsheet to a .xlsx file.
|
||||
Xlsx file format is the main file format of PHPExcel. It allows outputting the in-memory spreadsheet to a .xlsx file.
|
||||
|
||||
#### PHPExcel_Reader_Excel2007
|
||||
|
||||
|
@ -131,7 +131,7 @@ $objWriter->save("05featuredemo.xlsx");
|
|||
|
||||
##### Office 2003 compatibility pack
|
||||
|
||||
Because of a bug in the Office2003 compatibility pack, there can be some small issues when opening Excel2007 spreadsheets (mostly related to formula calculation). You can enable Office2003 compatibility with the following code:
|
||||
Because of a bug in the Office2003 compatibility pack, there can be some small issues when opening Xlsx spreadsheets (mostly related to formula calculation). You can enable Office2003 compatibility with the following code:
|
||||
|
||||
```
|
||||
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
|
||||
|
|
|
@ -15,7 +15,7 @@ The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary file for
|
|||
|
||||
Microsoft Excel™ 2003 included options for a file format called SpreadsheetML. This file is a zipped XML document. It is not very common, but its core features are supported. Documentation for the format can be found at [http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx][3] though it’s sadly rather sparse in its detail.
|
||||
|
||||
### Excel2007
|
||||
### Xlsx
|
||||
|
||||
Microsoft Excel™ 2007 shipped with a new file format, namely Microsoft Office Open XML SpreadsheetML, and Excel 2010 extended this still further with its new features such as sparklines. These files typically have an extension of .xlsx. This format is based around a zipped collection of eXtensible Markup Language (XML) files. Microsoft Office Open XML SpreadsheetML is mostly standardized in ECMA 376 ([http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm][4]) and ISO 29500.
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Alternatively, you can use the IO Factory's createReader() method to instantiate
|
|||
|
||||
```php
|
||||
$inputFileType = 'Excel5';
|
||||
// $inputFileType = 'Excel2007';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'OOCalc';
|
||||
// $inputFileType = 'SYLK';
|
||||
|
|
|
@ -27,10 +27,10 @@ The Gnumeric loader has been written to read the format masks for date values ev
|
|||
|
||||
Reading Only Data from a Spreadsheet File applies to Readers:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | YES | Excel5 | YES | Excel2003XML | YES |
|
||||
OOCalc | YES | SYLK | NO | Gnumeric | YES |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | YES | Excel5 | YES | Excel2003XML | YES |
|
||||
OOCalc | YES | SYLK | NO | Gnumeric | YES |
|
||||
CSV | NO | HTML | NO
|
||||
|
||||
### Reading Only Named WorkSheets from a File
|
||||
|
@ -40,31 +40,31 @@ If your workbook contains a number of worksheets, but you are only interested in
|
|||
To read a single sheet, you can pass that sheet name as a parameter to the setLoadSheetsOnly() method.
|
||||
|
||||
```php
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetname = 'Data Sheet #2';
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetname = 'Data Sheet #2';
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Advise the Reader of which WorkSheets we want to load **/
|
||||
$objReader->setLoadSheetsOnly($sheetname);
|
||||
/** Load $inputFileName to a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Advise the Reader of which WorkSheets we want to load **/
|
||||
$objReader->setLoadSheetsOnly($sheetname);
|
||||
/** Load $inputFileName to a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
```
|
||||
> See Examples/Reader/exampleReader07.php for a working example of this code.
|
||||
|
||||
If you want to read more than just a single sheet, you can pass a list of sheet names as an array parameter to the setLoadSheetsOnly() method.
|
||||
|
||||
```php
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetnames = array('Data Sheet #1','Data Sheet #3');
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetnames = array('Data Sheet #1','Data Sheet #3');
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Advise the Reader of which WorkSheets we want to load **/
|
||||
$objReader->setLoadSheetsOnly($sheetnames);
|
||||
/** Load $inputFileName to a PHPExcel Object **/
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Advise the Reader of which WorkSheets we want to load **/
|
||||
$objReader->setLoadSheetsOnly($sheetnames);
|
||||
/** Load $inputFileName to a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
```
|
||||
> See Examples/Reader/exampleReader08.php for a working example of this code.
|
||||
|
@ -86,10 +86,10 @@ $objPHPExcel = $objReader->load($inputFileName);
|
|||
|
||||
Reading Only Named WorkSheets from a File applies to Readers:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | YES | Excel5 | YES | Excel2003XML | YES |
|
||||
OOCalc | YES | SYLK | NO | Gnumeric | YES |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | YES | Excel5 | YES | Excel2003XML | YES |
|
||||
OOCalc | YES | SYLK | NO | Gnumeric | YES |
|
||||
CSV | NO | HTML | NO
|
||||
|
||||
### Reading Only Specific Columns and Rows from a File (Read Filters)
|
||||
|
@ -97,66 +97,66 @@ CSV | NO | HTML | NO
|
|||
If you are only interested in reading part of a worksheet, then you can write a filter class that identifies whether or not individual cells should be read by the loader. A read filter must implement the PHPExcel_Reader_IReadFilter interface, and contain a readCell() method that accepts arguments of $column, $row and $worksheetName, and return a boolean true or false that indicates whether a workbook cell identified by those arguments should be read or not.
|
||||
|
||||
```php
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetname = 'Data Sheet #3';
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetname = 'Data Sheet #3';
|
||||
|
||||
|
||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
// Read rows 1 to 7 and columns A to E only
|
||||
if ($row >= 1 && $row <= 7) {
|
||||
if (in_array($column,range('A','E'))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
// Read rows 1 to 7 and columns A to E only
|
||||
if ($row >= 1 && $row <= 7) {
|
||||
if (in_array($column,range('A','E'))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Create an Instance of our Read Filter **/
|
||||
$filterSubset = new MyReadFilter();
|
||||
/** Create an Instance of our Read Filter **/
|
||||
$filterSubset = new MyReadFilter();
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Tell the Reader that we want to use the Read Filter **/
|
||||
$objReader->setReadFilter($filterSubset);
|
||||
/** Load only the rows and columns that match our filter to PHPExcel **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Tell the Reader that we want to use the Read Filter **/
|
||||
$objReader->setReadFilter($filterSubset);
|
||||
/** Load only the rows and columns that match our filter to PHPExcel **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
```
|
||||
> See Examples/Reader/exampleReader09.php for a working example of this code.
|
||||
|
||||
This example is not particularly useful, because it can only be used in a very specific circumstance (when you only want cells in the range A1:E7 from your worksheet. A generic Read Filter would probably be more useful:
|
||||
|
||||
```php
|
||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
private $_startRow = 0;
|
||||
private $_endRow = 0;
|
||||
private $_columns = array();
|
||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
private $_startRow = 0;
|
||||
private $_endRow = 0;
|
||||
private $_columns = array();
|
||||
|
||||
/** Get the list of rows and columns to read */
|
||||
public function __construct($startRow, $endRow, $columns) {
|
||||
$this->_startRow = $startRow;
|
||||
$this->_endRow = $endRow;
|
||||
$this->_columns = $columns;
|
||||
}
|
||||
/** Get the list of rows and columns to read */
|
||||
public function __construct($startRow, $endRow, $columns) {
|
||||
$this->_startRow = $startRow;
|
||||
$this->_endRow = $endRow;
|
||||
$this->_columns = $columns;
|
||||
}
|
||||
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
// Only read the rows and columns that were configured
|
||||
if ($row >= $this->_startRow && $row <= $this->_endRow) {
|
||||
if (in_array($column,$this->_columns)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
// Only read the rows and columns that were configured
|
||||
if ($row >= $this->_startRow && $row <= $this->_endRow) {
|
||||
if (in_array($column,$this->_columns)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Create an Instance of our Read Filter, passing in the cell range **/
|
||||
/** Create an Instance of our Read Filter, passing in the cell range **/
|
||||
$filterSubset = new MyReadFilter(9,15,range('G','K'));
|
||||
```
|
||||
> See Examples/Reader/exampleReader10.php for a working example of this code.
|
||||
|
@ -164,61 +164,61 @@ $filterSubset = new MyReadFilter(9,15,range('G','K'));
|
|||
This can be particularly useful for conserving memory, by allowing you to read and process a large workbook in “chunks”: an example of this usage might be when transferring data from an Excel worksheet to a database.
|
||||
|
||||
```php
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example2.xls';
|
||||
$inputFileType = 'Excel5';
|
||||
$inputFileName = './sampleData/example2.xls';
|
||||
|
||||
|
||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
private $_startRow = 0;
|
||||
private $_endRow = 0;
|
||||
/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
|
||||
class chunkReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
private $_startRow = 0;
|
||||
private $_endRow = 0;
|
||||
|
||||
/** Set the list of rows that we want to read */
|
||||
public function setRows($startRow, $chunkSize) {
|
||||
$this->_startRow = $startRow;
|
||||
$this->_endRow = $startRow + $chunkSize;
|
||||
}
|
||||
/** Set the list of rows that we want to read */
|
||||
public function setRows($startRow, $chunkSize) {
|
||||
$this->_startRow = $startRow;
|
||||
$this->_endRow = $startRow + $chunkSize;
|
||||
}
|
||||
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
// Only read the heading row, and the configured rows
|
||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public function readCell($column, $row, $worksheetName = '') {
|
||||
// Only read the heading row, and the configured rows
|
||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
|
||||
|
||||
/** Define how many rows we want to read for each "chunk" **/
|
||||
$chunkSize = 2048;
|
||||
/** Create a new Instance of our Read Filter **/
|
||||
$chunkFilter = new chunkReadFilter();
|
||||
/** Define how many rows we want to read for each "chunk" **/
|
||||
$chunkSize = 2048;
|
||||
/** Create a new Instance of our Read Filter **/
|
||||
$chunkFilter = new chunkReadFilter();
|
||||
|
||||
/** Tell the Reader that we want to use the Read Filter **/
|
||||
$objReader->setReadFilter($chunkFilter);
|
||||
/** Tell the Reader that we want to use the Read Filter **/
|
||||
$objReader->setReadFilter($chunkFilter);
|
||||
|
||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
||||
for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) {
|
||||
/** Tell the Read Filter which rows we want this iteration **/
|
||||
$chunkFilter->setRows($startRow,$chunkSize);
|
||||
/** Load only the rows that match our filter **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
// Do some processing here
|
||||
}
|
||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
||||
for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) {
|
||||
/** Tell the Read Filter which rows we want this iteration **/
|
||||
$chunkFilter->setRows($startRow,$chunkSize);
|
||||
/** Load only the rows that match our filter **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
// Do some processing here
|
||||
}
|
||||
```
|
||||
> See Examples/Reader/exampleReader12.php for a working example of this code.
|
||||
|
||||
Using Read Filters applies to:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | YES | Excel5 | YES | Excel2003XML | YES |
|
||||
OOCalc | YES | SYLK | NO | Gnumeric | YES |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | YES | Excel5 | YES | Excel2003XML | YES |
|
||||
OOCalc | YES | SYLK | NO | Gnumeric | YES |
|
||||
CSV | YES | HTML | NO
|
||||
|
||||
### Combining Multiple Files into a Single PHPExcel Object
|
||||
|
@ -226,35 +226,35 @@ CSV | YES | HTML | NO
|
|||
While you can limit the number of worksheets that are read from a workbook file using the setLoadSheetsOnly() method, certain readers also allow you to combine several individual "sheets" from different files into a single PHPExcel object, where each individual file is a single worksheet within that workbook. For each file that you read, you need to indicate which worksheet index it should be loaded into using the setSheetIndex() method of the $objReader, then use the loadIntoExisting() method rather than the load() method to actually read the file into that worksheet.
|
||||
|
||||
```php
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileNames = array('./sampleData/example1.csv',
|
||||
'./sampleData/example2.csv'
|
||||
'./sampleData/example3.csv'
|
||||
);
|
||||
);
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
|
||||
|
||||
/** Extract the first named file from the array list **/
|
||||
$inputFileName = array_shift($inputFileNames);
|
||||
/** Load the initial file to the first worksheet in a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
/** Set the worksheet title (to the filename that we've loaded) **/
|
||||
/** Extract the first named file from the array list **/
|
||||
$inputFileName = array_shift($inputFileNames);
|
||||
/** Load the initial file to the first worksheet in a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
/** Set the worksheet title (to the filename that we've loaded) **/
|
||||
$objPHPExcel->getActiveSheet()
|
||||
->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
|
||||
->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
|
||||
|
||||
|
||||
/** Loop through all the remaining files in the list **/
|
||||
foreach($inputFileNames as $sheet => $inputFileName) {
|
||||
/** Increment the worksheet index pointer for the Reader **/
|
||||
$objReader->setSheetIndex($sheet+1);
|
||||
/** Load the current file into a new worksheet in PHPExcel **/
|
||||
$objReader->loadIntoExisting($inputFileName,$objPHPExcel);
|
||||
/** Set the worksheet title (to the filename that we've loaded) **/
|
||||
/** Loop through all the remaining files in the list **/
|
||||
foreach($inputFileNames as $sheet => $inputFileName) {
|
||||
/** Increment the worksheet index pointer for the Reader **/
|
||||
$objReader->setSheetIndex($sheet+1);
|
||||
/** Load the current file into a new worksheet in PHPExcel **/
|
||||
$objReader->loadIntoExisting($inputFileName,$objPHPExcel);
|
||||
/** Set the worksheet title (to the filename that we've loaded) **/
|
||||
$objPHPExcel->getActiveSheet()
|
||||
->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
|
||||
}
|
||||
->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
|
||||
}
|
||||
```
|
||||
> See Examples/Reader/exampleReader13.php for a working example of this code.
|
||||
|
||||
|
@ -262,56 +262,56 @@ Note that using the same sheet index for multiple sheets won't append files into
|
|||
|
||||
Combining Multiple Files into a Single PHPExcel Object applies to:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | YES | Gnumeric | NO |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | YES | Gnumeric | NO |
|
||||
CSV | YES | HTML | NO
|
||||
|
||||
### Combining Read Filters with the setSheetIndex() method to split a large CSV file across multiple Worksheets
|
||||
|
||||
An Excel5 BIFF .xls file is limited to 65536 rows in a worksheet, while the Excel2007 Microsoft Office Open XML SpreadsheetML .xlsx file is limited to 1,048,576 rows in a worksheet; but a CSV file is not limited other than by available disk space. This means that we wouldn’t ordinarily be able to read all the rows from a very large CSV file that exceeded those limits, and save it as an Excel5 or Excel2007 file. However, by using Read Filters to read the CSV file in “chunks” (using the chunkReadFilter Class that we defined in section REF _Ref275604563 \r \p 5.3 above), and the setSheetIndex() method of the $objReader, we can split the CSV file across several individual worksheets.
|
||||
An Excel5 BIFF .xls file is limited to 65536 rows in a worksheet, while the Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to 1,048,576 rows in a worksheet; but a CSV file is not limited other than by available disk space. This means that we wouldn’t ordinarily be able to read all the rows from a very large CSV file that exceeded those limits, and save it as an Excel5 or Xlsx file. However, by using Read Filters to read the CSV file in “chunks” (using the chunkReadFilter Class that we defined in section REF _Ref275604563 \r \p 5.3 above), and the setSheetIndex() method of the $objReader, we can split the CSV file across several individual worksheets.
|
||||
|
||||
```php
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileName = './sampleData/example2.csv';
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileName = './sampleData/example2.csv';
|
||||
|
||||
|
||||
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />';
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
|
||||
|
||||
/** Define how many rows we want to read for each "chunk" **/
|
||||
$chunkSize = 65530;
|
||||
/** Create a new Instance of our Read Filter **/
|
||||
$chunkFilter = new chunkReadFilter();
|
||||
/** Define how many rows we want to read for each "chunk" **/
|
||||
$chunkSize = 65530;
|
||||
/** Create a new Instance of our Read Filter **/
|
||||
$chunkFilter = new chunkReadFilter();
|
||||
|
||||
/** Tell the Reader that we want to use the Read Filter **/
|
||||
/** Tell the Reader that we want to use the Read Filter **/
|
||||
/** and that we want to store it in contiguous rows/columns **/
|
||||
|
||||
$objReader->setReadFilter($chunkFilter)
|
||||
->setContiguous(true);
|
||||
|
||||
/** Instantiate a new PHPExcel object manually **/
|
||||
$objPHPExcel = new PHPExcel();
|
||||
/** Instantiate a new PHPExcel object manually **/
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
/** Set a sheet index **/
|
||||
$sheet = 0;
|
||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
||||
/** $startRow is set to 2 initially because we always read the headings in row #1 **/
|
||||
for ($startRow = 2; $startRow <= 1000000; $startRow += $chunkSize) {
|
||||
/** Tell the Read Filter which rows we want to read this loop **/
|
||||
$chunkFilter->setRows($startRow,$chunkSize);
|
||||
/** Set a sheet index **/
|
||||
$sheet = 0;
|
||||
/** Loop to read our worksheet in "chunk size" blocks **/
|
||||
/** $startRow is set to 2 initially because we always read the headings in row #1 **/
|
||||
for ($startRow = 2; $startRow <= 1000000; $startRow += $chunkSize) {
|
||||
/** Tell the Read Filter which rows we want to read this loop **/
|
||||
$chunkFilter->setRows($startRow,$chunkSize);
|
||||
|
||||
/** Increment the worksheet index pointer for the Reader **/
|
||||
$objReader->setSheetIndex($sheet);
|
||||
/** Load only the rows that match our filter into a new worksheet **/
|
||||
$objReader->loadIntoExisting($inputFileName,$objPHPExcel);
|
||||
/** Increment the worksheet index pointer for the Reader **/
|
||||
$objReader->setSheetIndex($sheet);
|
||||
/** Load only the rows that match our filter into a new worksheet **/
|
||||
$objReader->loadIntoExisting($inputFileName,$objPHPExcel);
|
||||
/** Set the worksheet title for the sheet that we've justloaded) **/
|
||||
/** and increment the sheet index as well **/
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Country Data #'.(++$sheet));
|
||||
}
|
||||
/** and increment the sheet index as well **/
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Country Data #'.(++$sheet));
|
||||
}
|
||||
```
|
||||
> See Examples/Reader/exampleReader14.php for a working example of this code.
|
||||
|
||||
|
@ -323,10 +323,10 @@ For example, if the filter returned true for cells in the range B2:C3, then with
|
|||
|
||||
Splitting a single loaded file across multiple worksheets applies to:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | NO | Gnumeric | NO |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | NO | Gnumeric | NO |
|
||||
CSV | YES | HTML | NO
|
||||
|
||||
### Pipe or Tab Separated Value Files
|
||||
|
@ -334,31 +334,31 @@ CSV | YES | HTML | NO
|
|||
The CSV loader defaults to loading a file where comma is used as the separator, but you can modify this to load tab- or pipe-separated value files using the setDelimiter() method.
|
||||
|
||||
```php
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileName = './sampleData/example1.tsv';
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileName = './sampleData/example1.tsv';
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Set the delimiter to a TAB character **/
|
||||
$objReader->setDelimiter("\t");
|
||||
/** Create a new Reader of the type defined in $inputFileType **/ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
/** Set the delimiter to a TAB character **/
|
||||
$objReader->setDelimiter("\t");
|
||||
// $objReader->setDelimiter('|');
|
||||
|
||||
/** Load the file to a PHPExcel Object **/
|
||||
/** Load the file to a PHPExcel Object **/
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
```
|
||||
> See Examples/Reader/exampleReader15.php for a working example of this code.
|
||||
|
||||
In addition to the delimiter, you can also use the following methods to set other attributes for the data load:
|
||||
|
||||
setEnclosure() | default is "
|
||||
setLineEnding() | default is PHP_EOL
|
||||
setInputEncoding() | default is UTF-8
|
||||
setEnclosure() | default is "
|
||||
setLineEnding() | default is PHP_EOL
|
||||
setInputEncoding() | default is UTF-8
|
||||
|
||||
Setting CSV delimiter applies to:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | NO | Gnumeric | NO |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | NO | Gnumeric | NO |
|
||||
CSV | YES | HTML | NO
|
||||
|
||||
### A Brief Word about the Advanced Value Binder
|
||||
|
@ -370,23 +370,23 @@ A Value Binder is a class that implement the PHPExcel_Cell_IValueBinder interfac
|
|||
So using a Value Binder allows a great deal more flexibility in the loader logic when reading unformatted text files.
|
||||
|
||||
```php
|
||||
/** Tell PHPExcel that we want to use the Advanced Value Binder **/
|
||||
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
|
||||
/** Tell PHPExcel that we want to use the Advanced Value Binder **/
|
||||
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
|
||||
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileName = './sampleData/example1.tsv';
|
||||
$inputFileType = 'CSV';
|
||||
$inputFileName = './sampleData/example1.tsv';
|
||||
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
$objReader->setDelimiter("\t");
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
$objReader->setDelimiter("\t");
|
||||
$objPHPExcel = $objReader->load($inputFileName);
|
||||
```
|
||||
> See Examples/Reader/exampleReader15.php for a working example of this code.
|
||||
|
||||
Loading using a Value Binder applies to:
|
||||
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | NO | Gnumeric | NO |
|
||||
Reader | Y/N |Reader | Y/N |Reader | Y/N |
|
||||
----------|:---:|--------|:---:|--------------|:---:|
|
||||
Xlsx | NO | Excel5 | NO | Excel2003XML | NO |
|
||||
OOCalc | NO | SYLK | NO | Gnumeric | NO |
|
||||
CSV | YES | HTML | YES
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ $spreadsheet->getActiveSheet()->setTitle('Simple');
|
|||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
// Save Excel 2007 file
|
||||
$helper->log('Write to Excel2007 format');
|
||||
$helper->log('Write to Xlsx format');
|
||||
|
||||
// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file
|
||||
// Use PCLZip rather than ZipArchive to create the Xlsx OfficeOpenXML file
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP);
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx']);
|
||||
$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx']);
|
||||
|
|
|
@ -38,7 +38,7 @@ $spreadsheet->getActiveSheet()->setTitle('Simple');
|
|||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
// Redirect output to a client’s web browser (Excel2007)
|
||||
// Redirect output to a client’s web browser (Xlsx)
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="01simple.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
@ -51,6 +51,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
|
|||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||
header('Pragma: public'); // HTTP/1.0
|
||||
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
exit;
|
||||
|
|
|
@ -71,7 +71,7 @@ $spreadsheet->getActiveSheet()
|
|||
// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the
|
||||
// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae
|
||||
// using functions or features (such as array formulae) that aren't yet supported by the calculation engine
|
||||
// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to
|
||||
// If the value is false (the default) for the Xlsx Writer, then MS Excel (or the application used to
|
||||
// open the file) will need to recalculate values itself to guarantee that the correct results are available.
|
||||
//
|
||||
//$writer->setPreCalculateFormulas(true);
|
||||
|
|
|
@ -5,12 +5,12 @@ require __DIR__ . '/Header.php';
|
|||
// Create temporary file that will be read
|
||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
$filename = $helper->getTemporaryFilename();
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
|
||||
$writer->save($filename);
|
||||
|
||||
$callStartTime = microtime(true);
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||
$helper->logRead('Xlsx', $filename, $callStartTime);
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__);
|
||||
|
|
|
@ -5,15 +5,15 @@ require __DIR__ . '/Header.php';
|
|||
// Create temporary file that will be read
|
||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
$filename = $helper->getTemporaryFilename();
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
|
||||
$writer->save($filename);
|
||||
|
||||
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
||||
// Use PCLZip rather than ZipArchive to read the Xlsx OfficeOpenXML file
|
||||
\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP);
|
||||
|
||||
$callStartTime = microtime(true);
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||
$helper->logRead('Xlsx', $filename, $callStartTime);
|
||||
$callEndTime = microtime(true);
|
||||
|
||||
// Save
|
||||
|
|
|
@ -166,7 +166,7 @@ for ($col = 'B'; $col != 'G'; ++$col) {
|
|||
// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the
|
||||
// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae
|
||||
// using functions or features (such as array formulae) that aren't yet supported by the calculation engine
|
||||
// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to
|
||||
// If the value is false (the default) for the Xlsx Writer, then MS Excel (or the application used to
|
||||
// open the file) will need to recalculate values itself to guarantee that the correct results are available.
|
||||
//
|
||||
//$writer->setPreCalculateFormulas(true);
|
||||
|
|
|
@ -23,8 +23,8 @@ $callStartTime = microtime(true);
|
|||
$spreadsheetFromCSV = $reader->load($filename);
|
||||
$helper->logRead('CSV', $filename, $callStartTime);
|
||||
|
||||
// Write Excel2007
|
||||
$helper->write($spreadsheetFromCSV, __FILE__, ['Excel2007' => 'xlsx']);
|
||||
// Write Xlsx
|
||||
$helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx' => 'xlsx']);
|
||||
|
||||
// Write CSV
|
||||
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require __DIR__ . '/Header.php';
|
||||
|
||||
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
||||
// Use PCLZip rather than ZipArchive to read the Xlsx OfficeOpenXML file
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP);
|
||||
|
||||
$filename = __DIR__ . '/templates/OOCalcTest.ods';
|
||||
|
|
|
@ -6,7 +6,7 @@ require __DIR__ . '/Header.php';
|
|||
|
||||
// Write temporary file
|
||||
$largeSpreadsheet = require __DIR__ . '/templates/largeSpreadsheet.php';
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($largeSpreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($largeSpreadsheet);
|
||||
$filename = $helper->getTemporaryFilename();
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
@ -25,12 +25,12 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
|||
}
|
||||
}
|
||||
|
||||
$helper->log('Load from Excel2007 file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||
$helper->log('Load from Xlsx file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
|
||||
$reader->setReadFilter(new MyReadFilter());
|
||||
$callStartTime = microtime(true);
|
||||
$spreadsheet = $reader->load($filename);
|
||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||
$helper->logRead('Xlsx', $filename, $callStartTime);
|
||||
$helper->log('Remove unnecessary rows');
|
||||
$spreadsheet->getActiveSheet()->removeRow(2, 18);
|
||||
|
||||
|
|
|
@ -34,4 +34,4 @@ $drawing->setHeight(36);
|
|||
$drawing->setWorksheet($spreadsheet->getActiveSheet());
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx', 'HTML' => 'html']);
|
||||
$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx', 'HTML' => 'html']);
|
||||
|
|
|
@ -12,13 +12,13 @@ $rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
|||
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||
|
||||
// Read from Excel2007 (.xlsx) template
|
||||
$helper->log('Load Excel2007 template file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||
// Read from Xlsx (.xlsx) template
|
||||
$helper->log('Load Xlsx template file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\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 */
|
||||
$helper->write($spreadsheet, __FILE__, ['Excel2007' => 'xlsx', 'Excel5' => 'xls', 'HTML' => 'html']);
|
||||
$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx', 'Excel5' => 'xls', 'HTML' => 'html']);
|
||||
|
||||
// Export to PDF (.pdf)
|
||||
$helper->log('Write to PDF format');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require __DIR__ . '/Header.php';
|
||||
|
||||
// Read from Excel5 (.xls) template
|
||||
$helper->log('Load Excel2007 template file');
|
||||
$helper->log('Load Xlsx template file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5');
|
||||
$spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls');
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ require __DIR__ . '/Header.php';
|
|||
|
||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
$filename = $helper->getTemporaryFilename();
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
$helper->logWrite($writer, $filename, $callStartTime);
|
||||
|
||||
$callStartTime = microtime(true);
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
|
||||
$spreadsheet = $reader->load($filename);
|
||||
$helper->logRead('Excel2007', $filename, $callStartTime);
|
||||
$helper->logRead('Xlsx', $filename, $callStartTime);
|
||||
$helper->log('Iterate worksheets');
|
||||
foreach ($spreadsheet->getWorksheetIterator() as $worksheet) {
|
||||
$helper->log('Worksheet - ' . $worksheet->getTitle());
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require __DIR__ . '/Header.php';
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileName = __DIR__ . '/templates/31docproperties.xlsx';
|
||||
|
||||
$spreadsheetReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||
|
@ -18,7 +18,7 @@ $spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document')
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
$helper->logWrite($writer, $filename, $callStartTime);
|
||||
|
@ -27,7 +27,7 @@ $helper->logWrite($writer, $filename, $callStartTime);
|
|||
$helper->logEndingNotes();
|
||||
|
||||
// Reread File
|
||||
$helper->log('Reread Excel2007 file');
|
||||
$helper->log('Reread Xlsx file');
|
||||
$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||
|
||||
// Set properties
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require __DIR__ . '/Header.php';
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileNames = __DIR__ . '/templates/32readwrite*[0-9].xlsx';
|
||||
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
|
@ -69,7 +69,7 @@ foreach ($inputFileNames as $inputFileName) {
|
|||
}
|
||||
|
||||
$outputFileName = $helper->getFilename($inputFileName);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($outputFileName);
|
||||
|
|
|
@ -14,7 +14,7 @@ if (!\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer($rendererName, $render
|
|||
return;
|
||||
}
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileNames = __DIR__ . '/templates/36write*.xlsx';
|
||||
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
|
|
|
@ -30,7 +30,7 @@ if (!\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer($rendererName, $render
|
|||
return;
|
||||
}
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileNames = __DIR__ . '/templates/36write*.xlsx';
|
||||
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -7,7 +7,7 @@ $spreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -92,7 +92,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -92,7 +92,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -101,7 +101,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -145,7 +145,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -89,7 +89,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -164,7 +164,7 @@ $worksheet->addChart($chart2);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -159,7 +159,7 @@ $worksheet->addChart($chart2);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -101,7 +101,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -86,7 +86,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -97,7 +97,7 @@ $worksheet->addChart($chart);
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -6,11 +6,11 @@ require __DIR__ . '/Header.php';
|
|||
// Create temporary file that will be read
|
||||
$sampleSpreadsheet = require __DIR__ . '/templates/chartSpreadsheet.php';
|
||||
$filename = $helper->getTemporaryFilename();
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
|
||||
$writer->save($filename);
|
||||
|
||||
$helper->log('Load from Excel2007 file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel2007');
|
||||
$helper->log('Load from Xlsx file');
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
|
||||
$reader->setIncludeCharts(true);
|
||||
$spreadsheet = $reader->load($filename);
|
||||
|
||||
|
@ -29,7 +29,7 @@ $worksheet->fromArray(
|
|||
|
||||
// Save Excel 2007 file
|
||||
$filename = $helper->getFilename(__FILE__);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->setIncludeCharts(true);
|
||||
$callStartTime = microtime(true);
|
||||
$writer->save($filename);
|
||||
|
|
|
@ -14,7 +14,7 @@ if (!\PhpOffice\PhpSpreadsheet\Settings::setChartRenderer($rendererName, $render
|
|||
return;
|
||||
}
|
||||
|
||||
$inputFileType = 'Excel2007';
|
||||
$inputFileType = 'Xlsx';
|
||||
$inputFileNames = __DIR__ . '/templates/32readwrite*[0-9].xlsx';
|
||||
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
require __DIR__ . '/Header.php';
|
||||
|
||||
$helper->log('Load MergeBook1 from Excel2007 file');
|
||||
$helper->log('Load MergeBook1 from Xlsx file');
|
||||
$filename1 = __DIR__ . '/templates/43mergeBook1.xlsx';
|
||||
$callStartTime = microtime(true);
|
||||
$spreadsheet1 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename1);
|
||||
$helper->logRead('Excel2007', $filename1, $callStartTime);
|
||||
$helper->logRead('Xlsx', $filename1, $callStartTime);
|
||||
|
||||
$helper->log('Load MergeBook2 from Excel2007 file');
|
||||
$helper->log('Load MergeBook2 from Xlsx file');
|
||||
$filename2 = __DIR__ . '/templates/43mergeBook2.xlsx';
|
||||
$callStartTime = microtime(true);
|
||||
$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename2);
|
||||
$helper->logRead('Excel2007', $filename2, $callStartTime);
|
||||
$helper->logRead('Xlsx', $filename2, $callStartTime);
|
||||
|
||||
foreach ($spreadsheet2->getSheetNames() as $sheetName) {
|
||||
$sheet = $spreadsheet2->getSheetByName($sheetName);
|
||||
|
|
|
@ -5,7 +5,7 @@ require __DIR__ . '/Header.php';
|
|||
// Create temporary file that will be read
|
||||
$sampleSpreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
$filename = $helper->getTemporaryFilename();
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
|
||||
$writer->save($filename);
|
||||
|
||||
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
|
||||
|
|
|
@ -78,7 +78,7 @@ class Sample
|
|||
* @param string $filename
|
||||
* @param array $writers
|
||||
*/
|
||||
public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Excel2007' => 'xlsx', 'Excel5' => 'xls'])
|
||||
public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx' => 'xlsx', 'Excel5' => 'xls'])
|
||||
{
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
|
|
@ -44,7 +44,7 @@ class IOFactory
|
|||
* @static
|
||||
*/
|
||||
private static $autoResolveClasses = [
|
||||
'Excel2007',
|
||||
'Xlsx',
|
||||
'Excel5',
|
||||
'Excel2003XML',
|
||||
'OOCalc',
|
||||
|
@ -106,7 +106,7 @@ class IOFactory
|
|||
*
|
||||
* @static
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $writerType Example: Excel2007
|
||||
* @param string $writerType Example: Xlsx
|
||||
* @throws Writer\Exception
|
||||
* @return Writer\IWriter
|
||||
*/
|
||||
|
@ -135,7 +135,7 @@ class IOFactory
|
|||
* Create Reader\IReader
|
||||
*
|
||||
* @static
|
||||
* @param string $readerType Example: Excel2007
|
||||
* @param string $readerType Example: Xlsx
|
||||
* @throws Reader\Exception
|
||||
* @return Reader\IReader
|
||||
*/
|
||||
|
@ -213,7 +213,7 @@ class IOFactory
|
|||
case 'xlsm': // Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded)
|
||||
case 'xltx': // Excel (OfficeOpenXML) Template
|
||||
case 'xltm': // Excel (OfficeOpenXML) Macro Template (macros will be discarded)
|
||||
$extensionType = 'Excel2007';
|
||||
$extensionType = 'Xlsx';
|
||||
break;
|
||||
case 'xls': // Excel (BIFF) Spreadsheet
|
||||
case 'xlt': // Excel (BIFF) Template
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class Excel2007 extends BaseReader implements IReader
|
||||
class Xlsx extends BaseReader implements IReader
|
||||
{
|
||||
/**
|
||||
* ReferenceHelper instance
|
||||
|
@ -34,14 +34,14 @@ class Excel2007 extends BaseReader implements IReader
|
|||
private $referenceHelper = null;
|
||||
|
||||
/**
|
||||
* Excel2007\Theme instance
|
||||
* Xlsx\Theme instance
|
||||
*
|
||||
* @var Excel2007\Theme
|
||||
* @var Xlsx\Theme
|
||||
*/
|
||||
private static $theme = null;
|
||||
|
||||
/**
|
||||
* Create a new Excel2007 Reader instance
|
||||
* Create a new Xlsx Reader instance
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ class Excel2007 extends BaseReader implements IReader
|
|||
$themeColours[$themePos] = $xmlColourData['val'];
|
||||
}
|
||||
}
|
||||
self::$theme = new Excel2007\Theme($themeName, $colourSchemeName, $themeColours);
|
||||
self::$theme = new Xlsx\Theme($themeName, $colourSchemeName, $themeColours);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1827,7 +1827,7 @@ class Excel2007 extends BaseReader implements IReader
|
|||
'SimpleXMLElement',
|
||||
\PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
$objChart = \PhpOffice\PhpSpreadsheet\Reader\Excel2007\Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
|
||||
$objChart = \PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
|
||||
|
||||
if (isset($charts[$chartEntryRef])) {
|
||||
$chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id'];
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -177,11 +177,11 @@ class OpenDocument extends BaseWriter implements IWriter
|
|||
}
|
||||
|
||||
/**
|
||||
* Set PhpSpreadsheet object
|
||||
* Set Spreadsheet object
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @return Excel2007
|
||||
* @return self
|
||||
*/
|
||||
public function setSpreadsheet(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,6 @@ namespace PhpOffice\PhpSpreadsheet\Writer\OpenDocument;
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
abstract class WriterPart extends \PhpOffice\PhpSpreadsheet\Writer\Excel2007\WriterPart
|
||||
abstract class WriterPart extends \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart
|
||||
{
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class Excel2007 extends BaseWriter implements IWriter
|
||||
class Xlsx extends BaseWriter implements IWriter
|
||||
{
|
||||
/**
|
||||
* Office2003 compatibility
|
||||
|
@ -38,7 +38,7 @@ class Excel2007 extends BaseWriter implements IWriter
|
|||
/**
|
||||
* Private writer parts
|
||||
*
|
||||
* @var Excel2007\WriterPart[]
|
||||
* @var Xlsx\WriterPart[]
|
||||
*/
|
||||
private $writerParts = [];
|
||||
|
||||
|
@ -106,7 +106,7 @@ class Excel2007 extends BaseWriter implements IWriter
|
|||
private $drawingHashTable;
|
||||
|
||||
/**
|
||||
* Create a new Excel2007 Writer
|
||||
* Create a new Xlsx Writer
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet
|
||||
*/
|
||||
|
@ -116,19 +116,19 @@ class Excel2007 extends BaseWriter implements IWriter
|
|||
$this->setSpreadsheet($spreadsheet);
|
||||
|
||||
$writerPartsArray = [
|
||||
'stringtable' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\StringTable',
|
||||
'contenttypes' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\ContentTypes',
|
||||
'docprops' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\DocProps',
|
||||
'rels' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Rels',
|
||||
'theme' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Theme',
|
||||
'style' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Style',
|
||||
'workbook' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Workbook',
|
||||
'worksheet' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Worksheet',
|
||||
'drawing' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Drawing',
|
||||
'comments' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Comments',
|
||||
'chart' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\Chart',
|
||||
'relsvba' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\RelsVBA',
|
||||
'relsribbonobjects' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Excel2007\\RelsRibbon',
|
||||
'stringtable' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\StringTable',
|
||||
'contenttypes' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\ContentTypes',
|
||||
'docprops' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\DocProps',
|
||||
'rels' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Rels',
|
||||
'theme' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Theme',
|
||||
'style' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Style',
|
||||
'workbook' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Workbook',
|
||||
'worksheet' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Worksheet',
|
||||
'drawing' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Drawing',
|
||||
'comments' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Comments',
|
||||
'chart' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Chart',
|
||||
'relsvba' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\RelsVBA',
|
||||
'relsribbonobjects' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\RelsRibbon',
|
||||
];
|
||||
|
||||
// Initialise writer parts
|
||||
|
@ -152,7 +152,7 @@ class Excel2007 extends BaseWriter implements IWriter
|
|||
* Get writer part
|
||||
*
|
||||
* @param string $pPartName Writer part name
|
||||
* @return \PhpOffice\PhpSpreadsheet\Writer\Excel2007\WriterPart
|
||||
* @return \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart
|
||||
*/
|
||||
public function getWriterPart($pPartName = '')
|
||||
{
|
||||
|
@ -416,7 +416,7 @@ class Excel2007 extends BaseWriter implements IWriter
|
|||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet PhpSpreadsheet object
|
||||
* @throws Exception
|
||||
* @return Excel2007
|
||||
* @return Xlsx
|
||||
*/
|
||||
public function setSpreadsheet(Spreadsheet $spreadsheet = null)
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ class Excel2007 extends BaseWriter implements IWriter
|
|||
* Set Office2003 compatibility
|
||||
*
|
||||
* @param bool $pValue Office2003 compatibility?
|
||||
* @return Excel2007
|
||||
* @return Xlsx
|
||||
*/
|
||||
public function setOffice2003Compatibility($pValue = false)
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Chart\Axis;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Chart;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
|
@ -269,7 +269,7 @@ class Style extends WriterPart
|
|||
{
|
||||
// font
|
||||
$objWriter->startElement('font');
|
||||
// Weird! The order of these elements actually makes a difference when opening Excel2007
|
||||
// Weird! The order of these elements actually makes a difference when opening Xlsx
|
||||
// files in Excel2003 with the compatibility pack. It's not documented behaviour,
|
||||
// and makes for a real WTF!
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* PhpSpreadsheet
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Excel2007;
|
||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006 - 2015 PhpSpreadsheet
|
|
@ -21,7 +21,7 @@ class SampleTest extends \PHPUnit_Framework_TestCase
|
|||
public function providerSample()
|
||||
{
|
||||
$skipped = [
|
||||
'07 Reader PCLZip', // Excel2007 cannot load file, leading to OpenOffice trying to and crashing. This is a bug that should be fixed
|
||||
'07 Reader PCLZip', // Xlsx cannot load file, leading to OpenOffice trying to and crashing. This is a bug that should be fixed
|
||||
'20 Read OOCalc with PCLZip', // Crash: Call to undefined method \PhpOffice\PhpSpreadsheet\Shared\ZipArchive::statName()
|
||||
'21 Pdf', // for now we don't have 3rdparty libs to tests PDF, but it should be added
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue