From 4337de4930b244455887fe99b18e81376896acd0 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 6 Oct 2016 20:49:41 +0900 Subject: [PATCH] Rename Excel5 into Xls FIX #4 --- CHANGELOG.md | 2 + .../Examples/Reader/exampleReader03.php | 2 +- .../Examples/Reader/exampleReader05.php | 2 +- .../Examples/Reader/exampleReader06.php | 2 +- .../Examples/Reader/exampleReader07.php | 2 +- .../Examples/Reader/exampleReader08.php | 2 +- .../Examples/Reader/exampleReader09.php | 2 +- .../Examples/Reader/exampleReader10.php | 2 +- .../Examples/Reader/exampleReader11.php | 2 +- .../Examples/Reader/exampleReader12.php | 2 +- .../Examples/Reader/exampleReader17.php | 2 +- .../Examples/Reader/exampleReader18.php | 2 +- .../Examples/Reader/exampleReader19.php | 2 +- .../exampleWorkBookReader01.php | 2 +- .../exampleWorkBookReader04.php | 2 +- .../02-General-Introduction.md | 4 +- .../03-03-Date-and-Time-Functions.md | 8 +- .../markdown/Overview/01-Getting-Started.md | 2 +- .../markdown/Overview/07-Accessing-Cells.md | 2 +- Documentation/markdown/Overview/08-Recipes.md | 4 +- .../Overview/10-Reading-and-Writing.md | 6 +- .../01-File-Formats.md | 2 +- .../03-Loading-a-Spreadsheet.md | 2 +- .../04-Loading-with-a-Reader.md | 4 +- .../05-Reader-Options.md | 28 +++--- samples/01_Simple_download_xls.php | 4 +- samples/14_Excel5.php | 2 +- samples/20_Read_Excel5.php | 6 +- samples/26_Utf8.php | 2 +- samples/27_Images_excel5.php | 4 +- samples/30_Template.php | 4 +- samples/31_Document_properties_write_xls.php | 6 +- src/PhpSpreadsheet/Helper/Sample.php | 2 +- src/PhpSpreadsheet/IOFactory.php | 4 +- .../Reader/{Excel5.php => Xls.php} | 76 +++++++-------- .../Reader/{Excel5 => Xls}/Color.php | 4 +- .../Reader/{Excel5 => Xls}/Color/BIFF5.php | 2 +- .../Reader/{Excel5 => Xls}/Color/BIFF8.php | 2 +- .../Reader/{Excel5 => Xls}/Color/BuiltIn.php | 2 +- .../Reader/{Excel5 => Xls}/ErrorCode.php | 2 +- .../Reader/{Excel5 => Xls}/Escher.php | 92 +++++++++---------- .../Reader/{Excel5 => Xls}/MD5.php | 2 +- .../Reader/{Excel5 => Xls}/RC4.php | 2 +- .../Reader/{Excel5 => Xls}/Style/Border.php | 2 +- .../{Excel5 => Xls}/Style/FillPattern.php | 2 +- .../Shared/{Excel5.php => Xls.php} | 2 +- .../Writer/{Excel5.php => Xls.php} | 16 ++-- .../Writer/{Excel5 => Xls}/BIFFwriter.php | 2 +- .../Writer/{Excel5 => Xls}/Escher.php | 2 +- .../Writer/{Excel5 => Xls}/Font.php | 2 +- .../Writer/{Excel5 => Xls}/Parser.php | 8 +- .../Writer/{Excel5 => Xls}/Workbook.php | 12 +-- .../Writer/{Excel5 => Xls}/Worksheet.php | 36 ++++---- .../Writer/{Excel5 => Xls}/Xf.php | 2 +- 54 files changed, 199 insertions(+), 197 deletions(-) rename src/PhpSpreadsheet/Reader/{Excel5.php => Xls.php} (98%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Color.php (86%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Color/BIFF5.php (97%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Color/BIFF8.php (97%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Color/BuiltIn.php (92%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/ErrorCode.php (91%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Escher.php (82%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/MD5.php (99%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/RC4.php (98%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Style/Border.php (95%) rename src/PhpSpreadsheet/Reader/{Excel5 => Xls}/Style/FillPattern.php (95%) rename src/PhpSpreadsheet/Shared/{Excel5.php => Xls.php} (99%) rename src/PhpSpreadsheet/Writer/{Excel5.php => Xls.php} (98%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/BIFFwriter.php (99%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/Escher.php (99%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/Font.php (98%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/Parser.php (99%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/Workbook.php (99%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/Worksheet.php (98%) rename src/PhpSpreadsheet/Writer/{Excel5 => Xls}/Xf.php (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93d25269..ea55fbe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). |---------------------------------|-------------------------------------------| | `PHPExcel` | `PhpOffice\PhpSpreadsheet\Spreadsheet` | | `PHPExcel_Reader_Excel2007` | `PhpOffice\PhpSpreadsheet\Reader\Xlsx` | +| `PHPExcel_Reader_Excel5` | `PhpOffice\PhpSpreadsheet\Reader\Xls` | | `PHPExcel_Writer_Excel2007` | `PhpOffice\PhpSpreadsheet\Writer\Xlsx` | +| `PHPExcel_Writer_Excel5` | `PhpOffice\PhpSpreadsheet\Writer\Xls` | - Some methods were renamed for clarity and/or consistency: diff --git a/Documentation/Examples/Reader/exampleReader03.php b/Documentation/Examples/Reader/exampleReader03.php index 4ec4d55e..c698a012 100644 --- a/Documentation/Examples/Reader/exampleReader03.php +++ b/Documentation/Examples/Reader/exampleReader03.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader05.php b/Documentation/Examples/Reader/exampleReader05.php index a5c473f0..ce8c9751 100644 --- a/Documentation/Examples/Reader/exampleReader05.php +++ b/Documentation/Examples/Reader/exampleReader05.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader06.php b/Documentation/Examples/Reader/exampleReader06.php index 6bbb8e0d..5e475204 100644 --- a/Documentation/Examples/Reader/exampleReader06.php +++ b/Documentation/Examples/Reader/exampleReader06.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader07.php b/Documentation/Examples/Reader/exampleReader07.php index cf9b981f..b359b81f 100644 --- a/Documentation/Examples/Reader/exampleReader07.php +++ b/Documentation/Examples/Reader/exampleReader07.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader08.php b/Documentation/Examples/Reader/exampleReader08.php index 76440eb3..90b4dfda 100644 --- a/Documentation/Examples/Reader/exampleReader08.php +++ b/Documentation/Examples/Reader/exampleReader08.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader09.php b/Documentation/Examples/Reader/exampleReader09.php index a4a87edc..3d0913d9 100644 --- a/Documentation/Examples/Reader/exampleReader09.php +++ b/Documentation/Examples/Reader/exampleReader09.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader10.php b/Documentation/Examples/Reader/exampleReader10.php index 6f7fc38c..a722c564 100644 --- a/Documentation/Examples/Reader/exampleReader10.php +++ b/Documentation/Examples/Reader/exampleReader10.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader11.php b/Documentation/Examples/Reader/exampleReader11.php index 3f053df4..26289b29 100644 --- a/Documentation/Examples/Reader/exampleReader11.php +++ b/Documentation/Examples/Reader/exampleReader11.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader12.php b/Documentation/Examples/Reader/exampleReader12.php index 4551b5e7..d4131ca7 100644 --- a/Documentation/Examples/Reader/exampleReader12.php +++ b/Documentation/Examples/Reader/exampleReader12.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader17.php b/Documentation/Examples/Reader/exampleReader17.php index 331fbcc7..de2e2a1e 100644 --- a/Documentation/Examples/Reader/exampleReader17.php +++ b/Documentation/Examples/Reader/exampleReader17.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader18.php b/Documentation/Examples/Reader/exampleReader18.php index b4bb9a5c..9aebb0f9 100644 --- a/Documentation/Examples/Reader/exampleReader18.php +++ b/Documentation/Examples/Reader/exampleReader18.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reader/exampleReader19.php b/Documentation/Examples/Reader/exampleReader19.php index 6d49ac95..cfb8a14e 100644 --- a/Documentation/Examples/Reader/exampleReader19.php +++ b/Documentation/Examples/Reader/exampleReader19.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php index 4f8dfdf7..8d8cb558 100644 --- a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php +++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example1.xls'; /** Create a new Reader of the type defined in $inputFileType **/ diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php index 05ff6374..c7d55822 100644 --- a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php +++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php @@ -26,7 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); include 'PHPExcel/IOFactory.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example2.xls'; /** Create a new Reader of the type defined in $inputFileType **/ diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md b/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md index b714d511..feaa239c 100644 --- a/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md +++ b/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md @@ -2,9 +2,9 @@ ## General Introduction -### Function that are not Supported in Excel5 +### Function that are not Supported in Xls -Not all functions are supported by the Excel 5 Writer. Use of these functions within your workbooks will result in an error when trying to write to Excel5. +Not all functions are supported by the Excel 5 Writer. Use of these functions within your workbooks will result in an error when trying to write to Xls. The following is the list of those functions that are implemented within PHPExcel, but that cannot currently be written to Excel 5. diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md b/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md index ab1c4c90..ea33bedd 100644 --- a/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md +++ b/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md @@ -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 Xlsx. +Care should be taken in workbooks that use string formatted dates in calculations when writing to Xls or Xlsx. #### DAY @@ -435,7 +435,7 @@ $retVal = call_user_func_array( ##### Notes -__WARNING:-__ This function does not currently work with the Excel5 Writer when a PHP Boolean is used for the third (optional) parameter (as shown in the example above), and the writer will generate and error. It will work if a numeric 0 or 1 is used for the method parameter; or if the Excel TRUE() and FALSE() functions are used instead. +__WARNING:-__ This function does not currently work with the Xls Writer when a PHP Boolean is used for the third (optional) parameter (as shown in the example above), and the writer will generate and error. It will work if a numeric 0 or 1 is used for the method parameter; or if the Excel TRUE() and FALSE() functions are used instead. #### EDATE @@ -498,7 +498,7 @@ $retVal = call_user_func_array( ###### Notes -__WARNING:-__ This function is currently not supported by the Excel5 Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak. +__WARNING:-__ This function is currently not supported by the Xls Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak. #### EOMONTH @@ -559,7 +559,7 @@ $retVal = call_user_func_array( ##### Notes -__WARNING:-__ This function is currently not supported by the Excel5 Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak. +__WARNING:-__ This function is currently not supported by the Xls Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak. #### HOUR diff --git a/Documentation/markdown/Overview/01-Getting-Started.md b/Documentation/markdown/Overview/01-Getting-Started.md index be5780c2..34ea3697 100644 --- a/Documentation/markdown/Overview/01-Getting-Started.md +++ b/Documentation/markdown/Overview/01-Getting-Started.md @@ -116,7 +116,7 @@ $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); Not all features of PHPExcel are implemented in all of the Reader / Writer classes. This is mostly due to underlying libraries not supporting a specific feature or not having implemented a specific feature. -For example autofilter is not implemented in PEAR Spreadsheet_Excel_writer, which is the base of our Excel5 writer. +For example autofilter is not implemented in PEAR Spreadsheet_Excel_writer, which is the base of our Xls writer. We are slowly building up a list of features, together with the different readers and writers that support them, in the "Functionality Cross-Reference.xls" file in the /Documentation folder. diff --git a/Documentation/markdown/Overview/07-Accessing-Cells.md b/Documentation/markdown/Overview/07-Accessing-Cells.md index 8493021f..010e534b 100644 --- a/Documentation/markdown/Overview/07-Accessing-Cells.md +++ b/Documentation/markdown/Overview/07-Accessing-Cells.md @@ -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 (Xlsx 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 Xls). ### Setting a range of cells from an array diff --git a/Documentation/markdown/Overview/08-Recipes.md b/Documentation/markdown/Overview/08-Recipes.md index 9156eb7d..004dac17 100644 --- a/Documentation/markdown/Overview/08-Recipes.md +++ b/Documentation/markdown/Overview/08-Recipes.md @@ -1082,7 +1082,7 @@ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Xlsx'); $objWriter->save('php://output'); ``` -Example of a script redirecting an Excel5 file to the client's browser: +Example of a script redirecting an Xls file to the client's browser: ```php /* Here there will be some code where you create $objPHPExcel */ @@ -1092,7 +1092,7 @@ header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="myfile.xls"'); header('Cache-Control: max-age=0'); -$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); +$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Xls'); $objWriter->save('php://output'); ``` diff --git a/Documentation/markdown/Overview/10-Reading-and-Writing.md b/Documentation/markdown/Overview/10-Reading-and-Writing.md index 312f4c69..5b62e9c3 100644 --- a/Documentation/markdown/Overview/10-Reading-and-Writing.md +++ b/Documentation/markdown/Overview/10-Reading-and-Writing.md @@ -144,9 +144,9 @@ Office2003 compatibility option should only be used when needed. This option dis ### Excel 5 (BIFF) file format -Excel5 file format is the old Excel file format, implemented in PHPExcel to provide a uniform manner to create both .xlsx and .xls files. It is basically a modified version of [PEAR Spreadsheet_Excel_Writer][21], although it has been extended and has fewer limitations and more features than the old PEAR library. This can read all BIFF versions that use OLE2: BIFF5 (introduced with office 95) through BIFF8, but cannot read earlier versions. +Xls file format is the old Excel file format, implemented in PHPExcel to provide a uniform manner to create both .xlsx and .xls files. It is basically a modified version of [PEAR Spreadsheet_Excel_Writer][21], although it has been extended and has fewer limitations and more features than the old PEAR library. This can read all BIFF versions that use OLE2: BIFF5 (introduced with office 95) through BIFF8, but cannot read earlier versions. -Excel5 file format will not be developed any further, it just provides an additional file format for PHPExcel. +Xls file format will not be developed any further, it just provides an additional file format for PHPExcel. __Excel5 (BIFF) limitations__ Please note that BIFF file format has some limits regarding to styling cells and handling large spreadsheets via PHP. @@ -704,7 +704,7 @@ $objWorksheet = $objPHPexcel->getActiveSheet(); $objWorksheet->getCell('A1')->setValue('John'); $objWorksheet->getCell('A2')->setValue('Smith'); -$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'Excel5'); +$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'Xls'); $objWriter->save('write.xls'); ``` diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md b/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md index 8ada4818..9dde98e0 100644 --- a/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md +++ b/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md @@ -7,7 +7,7 @@ PHPExcel can read a number of different spreadsheet and file formats, although n Currently, PHPExcel supports the following File Types for Reading: -### Excel5 +### Xls The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary file format that was used by Microsoft Excel™ between versions 95 and 2003. The format is supported (to various extents) by most spreadsheet programs. BIFF files normally have an extension of .xls. Documentation describing the format can be found online at [http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx][1] or from [http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/[MS-XLS].pdf][2] (as a downloadable PDF). diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md b/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md index afa674d1..e5e6ffe9 100644 --- a/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md +++ b/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md @@ -15,7 +15,7 @@ $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); The load() method will attempt to identify the file type, and instantiate a loader for that file type; using it to load the file and store the data and any formatting in a PHPExcel object. -The method makes an initial guess at the loader to instantiate based on the file extension; but will test the file before actually executing the load: so if (for example) the file is actually a CSV file or contains HTML markup, but that has been given a .xls extension (quite a common practise), it will reject the Excel5 loader that it would normally use for a .xls file; and test the file using the other loaders until it finds the appropriate loader, and then use that to read the file. +The method makes an initial guess at the loader to instantiate based on the file extension; but will test the file before actually executing the load: so if (for example) the file is actually a CSV file or contains HTML markup, but that has been given a .xls extension (quite a common practise), it will reject the Xls loader that it would normally use for a .xls file; and test the file using the other loaders until it finds the appropriate loader, and then use that to read the file. While easy to implement in your code, and you don't need to worry about the file type; this isn't the most efficient method to load a file; and it lacks the flexibility to configure the loader in any way before actually reading the file into a PHPExcel object. diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md b/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md index 5f8c3079..a52298cb 100644 --- a/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md +++ b/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md @@ -8,7 +8,7 @@ If you know the file type of the spreadsheet file that you need to load, you can ```php $inputFileName = './sampleData/example1.xls'; -/** Create a new Excel5 Reader **/ +/** Create a new Xls Reader **/ $objReader = new PHPExcel_Reader_Excel5(); // $objReader = new PHPExcel_Reader_Excel2007(); // $objReader = new PHPExcel_Reader_Excel2003XML(); @@ -24,7 +24,7 @@ $objPHPExcel = $objReader->load($inputFileName); Alternatively, you can use the IO Factory's createReader() method to instantiate the reader object for you, simply telling it the file type of the reader that you want instantiating. ```php -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; // $inputFileType = 'Excel2003XML'; // $inputFileType = 'OOCalc'; diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md b/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md index d355fe3d..a9d985d2 100644 --- a/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md +++ b/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md @@ -9,7 +9,7 @@ Once you have created a reader object for the workbook that you want to load, yo If you're only interested in the cell values in a workbook, but don't need any of the cell formatting information, then you can set the reader to read only the data values and any formulae from each cell using the setReadDataOnly() method. ```php -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example1.xls'; /** Create a new Reader of the type defined in $inputFileType **/ @@ -29,7 +29,7 @@ Reading Only Data from a Spreadsheet File applies to Readers: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Excel5 | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Excel2003XML | YES | OOCalc | YES | SYLK | NO | Gnumeric | YES | CSV | NO | HTML | NO @@ -40,7 +40,7 @@ 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'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example1.xls'; $sheetname = 'Data Sheet #2'; @@ -56,7 +56,7 @@ $objPHPExcel = $objReader->load($inputFileName); 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'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example1.xls'; $sheetnames = array('Data Sheet #1','Data Sheet #3'); @@ -72,7 +72,7 @@ $objPHPExcel = $objReader->load($inputFileName); To reset this option to the default, you can call the setLoadAllSheets() method. ```php -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example1.xls'; /** Create a new Reader of the type defined in $inputFileType **/ @@ -88,7 +88,7 @@ Reading Only Named WorkSheets from a File applies to Readers: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Excel5 | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Excel2003XML | YES | OOCalc | YES | SYLK | NO | Gnumeric | YES | CSV | NO | HTML | NO @@ -97,7 +97,7 @@ 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'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example1.xls'; $sheetname = 'Data Sheet #3'; @@ -164,7 +164,7 @@ $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'; +$inputFileType = 'Xls'; $inputFileName = './sampleData/example2.xls'; @@ -217,7 +217,7 @@ Using Read Filters applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Excel5 | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Excel2003XML | YES | OOCalc | YES | SYLK | NO | Gnumeric | YES | CSV | YES | HTML | NO @@ -264,13 +264,13 @@ Combining Multiple Files into a Single PHPExcel Object applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Excel5 | NO | Excel2003XML | NO | +Xlsx | NO | Xls | 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 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. +An Xls 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 Xls 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'; @@ -325,7 +325,7 @@ Splitting a single loaded file across multiple worksheets applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Excel5 | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Excel2003XML | NO | OOCalc | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | NO @@ -357,7 +357,7 @@ Setting CSV delimiter applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Excel5 | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Excel2003XML | NO | OOCalc | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | NO @@ -386,7 +386,7 @@ Loading using a Value Binder applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Excel5 | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Excel2003XML | NO | OOCalc | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | YES diff --git a/samples/01_Simple_download_xls.php b/samples/01_Simple_download_xls.php index 3b9c41d2..7bfd5cc6 100644 --- a/samples/01_Simple_download_xls.php +++ b/samples/01_Simple_download_xls.php @@ -39,7 +39,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 (Excel5) +// Redirect output to a client’s web browser (Xls) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="01simple.xls"'); header('Cache-Control: max-age=0'); @@ -52,6 +52,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header('Pragma: public'); // HTTP/1.0 -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5'); +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); $writer->save('php://output'); exit; diff --git a/samples/14_Excel5.php b/samples/14_Excel5.php index 8b0aec15..86d125b9 100644 --- a/samples/14_Excel5.php +++ b/samples/14_Excel5.php @@ -4,7 +4,7 @@ require __DIR__ . '/Header.php'; $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php'; $filename = $helper->getFilename(__FILE__, 'xls'); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5'); +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); $callStartTime = microtime(true); $writer->save($filename); diff --git a/samples/20_Read_Excel5.php b/samples/20_Read_Excel5.php index 6592def3..ef8b1eda 100644 --- a/samples/20_Read_Excel5.php +++ b/samples/20_Read_Excel5.php @@ -6,15 +6,15 @@ $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php'; // Write temporary file $filename = $helper->getTemporaryFilename('xls'); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5'); +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); $callStartTime = microtime(true); $writer->save($filename); $helper->logWrite($writer, $filename, $callStartTime); -// Read Excel5 file +// Read Xls file $callStartTime = microtime(true); $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename); -$helper->logRead('Excel5', $filename, $callStartTime); +$helper->logRead('Xls', $filename, $callStartTime); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/26_Utf8.php b/samples/26_Utf8.php index 5c634b26..2edad0eb 100644 --- a/samples/26_Utf8.php +++ b/samples/26_Utf8.php @@ -18,7 +18,7 @@ $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__, ['Xlsx' => 'xlsx', 'Excel5' => 'xls', 'HTML' => 'html']); +$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx', 'Xls' => 'xls', 'HTML' => 'html']); // Export to PDF (.pdf) $helper->log('Write to PDF format'); diff --git a/samples/27_Images_excel5.php b/samples/27_Images_excel5.php index 9a6a8007..8fc7bf2b 100644 --- a/samples/27_Images_excel5.php +++ b/samples/27_Images_excel5.php @@ -2,9 +2,9 @@ require __DIR__ . '/Header.php'; -// Read from Excel5 (.xls) template +// Read from Xls (.xls) template $helper->log('Load Xlsx template file'); -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5'); +$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xls'); $spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls'); // Save diff --git a/samples/30_Template.php b/samples/30_Template.php index cb708c75..ed6f588e 100644 --- a/samples/30_Template.php +++ b/samples/30_Template.php @@ -2,8 +2,8 @@ require __DIR__ . '/Header.php'; -$helper->log('Load from Excel5 template'); -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Excel5'); +$helper->log('Load from Xls template'); +$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xls'); $spreadsheet = $reader->load(__DIR__ . '/templates/30template.xls'); $helper->log('Add new data to the template'); diff --git a/samples/31_Document_properties_write_xls.php b/samples/31_Document_properties_write_xls.php index dfdbef3b..38f15354 100644 --- a/samples/31_Document_properties_write_xls.php +++ b/samples/31_Document_properties_write_xls.php @@ -2,7 +2,7 @@ require __DIR__ . '/Header.php'; -$inputFileType = 'Excel5'; +$inputFileType = 'Xls'; $inputFileName = __DIR__ . '/templates/31docproperties.xls'; $spreadsheetReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); @@ -18,7 +18,7 @@ $spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document') // Save Excel 95 file $filename = $helper->getFilename(__FILE__, 'xls'); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel5'); +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); $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 Excel5 file'); +$helper->log('Reread Xls file'); $spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename); // Set properties diff --git a/src/PhpSpreadsheet/Helper/Sample.php b/src/PhpSpreadsheet/Helper/Sample.php index f9e6451f..1fe7f4ae 100644 --- a/src/PhpSpreadsheet/Helper/Sample.php +++ b/src/PhpSpreadsheet/Helper/Sample.php @@ -78,7 +78,7 @@ class Sample * @param string $filename * @param array $writers */ - public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx' => 'xlsx', 'Excel5' => 'xls']) + public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx' => 'xlsx', 'Xls' => 'xls']) { // Set active sheet index to the first sheet, so Excel opens this as the first sheet $spreadsheet->setActiveSheetIndex(0); diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index 39844fd7..68c2a51c 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -45,7 +45,7 @@ class IOFactory */ private static $autoResolveClasses = [ 'Xlsx', - 'Excel5', + 'Xls', 'Excel2003XML', 'OOCalc', 'SYLK', @@ -217,7 +217,7 @@ class IOFactory break; case 'xls': // Excel (BIFF) Spreadsheet case 'xlt': // Excel (BIFF) Template - $extensionType = 'Excel5'; + $extensionType = 'Xls'; break; case 'ods': // Open/Libre Offic Calc case 'ots': // Open/Libre Offic Calc Template diff --git a/src/PhpSpreadsheet/Reader/Excel5.php b/src/PhpSpreadsheet/Reader/Xls.php similarity index 98% rename from src/PhpSpreadsheet/Reader/Excel5.php rename to src/PhpSpreadsheet/Reader/Xls.php index 6d0f3825..f7871c3b 100644 --- a/src/PhpSpreadsheet/Reader/Excel5.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -55,7 +55,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; // Patch code for user-defined named cells supports single cells only. // NOTE: this patch only works for BIFF8 as BIFF5-7 use a different // external sheet reference structure -class Excel5 extends BaseReader implements IReader +class Xls extends BaseReader implements IReader { // ParseXL definitions const XLS_BIFF8 = 0x0600; @@ -383,7 +383,7 @@ class Excel5 extends BaseReader implements IReader /** * The current RC4 decryption object * - * @var Excel5\RC4 + * @var Xls\RC4 */ private $rc4Key = null; @@ -402,7 +402,7 @@ class Excel5 extends BaseReader implements IReader private $md5Ctxt = null; /** - * Create a new Excel5 Reader instance + * Create a new Xls Reader instance */ public function __construct() { @@ -713,7 +713,7 @@ class Excel5 extends BaseReader implements IReader if (!$this->readDataOnly) { foreach ($this->objFonts as $objFont) { if (isset($objFont->colorIndex)) { - $color = Excel5\Color::map($objFont->colorIndex, $this->palette, $this->version); + $color = Xls\Color::map($objFont->colorIndex, $this->palette, $this->version); $objFont->getColor()->setRGB($color['rgb']); } } @@ -723,11 +723,11 @@ class Excel5 extends BaseReader implements IReader $fill = $objStyle->getFill(); if (isset($fill->startcolorIndex)) { - $startColor = Excel5\Color::map($fill->startcolorIndex, $this->palette, $this->version); + $startColor = Xls\Color::map($fill->startcolorIndex, $this->palette, $this->version); $fill->getStartColor()->setRGB($startColor['rgb']); } if (isset($fill->endcolorIndex)) { - $endColor = Excel5\Color::map($fill->endcolorIndex, $this->palette, $this->version); + $endColor = Xls\Color::map($fill->endcolorIndex, $this->palette, $this->version); $fill->getEndColor()->setRGB($endColor['rgb']); } @@ -739,23 +739,23 @@ class Excel5 extends BaseReader implements IReader $diagonal = $objStyle->getBorders()->getDiagonal(); if (isset($top->colorIndex)) { - $borderTopColor = Excel5\Color::map($top->colorIndex, $this->palette, $this->version); + $borderTopColor = Xls\Color::map($top->colorIndex, $this->palette, $this->version); $top->getColor()->setRGB($borderTopColor['rgb']); } if (isset($right->colorIndex)) { - $borderRightColor = Excel5\Color::map($right->colorIndex, $this->palette, $this->version); + $borderRightColor = Xls\Color::map($right->colorIndex, $this->palette, $this->version); $right->getColor()->setRGB($borderRightColor['rgb']); } if (isset($bottom->colorIndex)) { - $borderBottomColor = Excel5\Color::map($bottom->colorIndex, $this->palette, $this->version); + $borderBottomColor = Xls\Color::map($bottom->colorIndex, $this->palette, $this->version); $bottom->getColor()->setRGB($borderBottomColor['rgb']); } if (isset($left->colorIndex)) { - $borderLeftColor = Excel5\Color::map($left->colorIndex, $this->palette, $this->version); + $borderLeftColor = Xls\Color::map($left->colorIndex, $this->palette, $this->version); $left->getColor()->setRGB($borderLeftColor['rgb']); } if (isset($diagonal->colorIndex)) { - $borderDiagonalColor = Excel5\Color::map($diagonal->colorIndex, $this->palette, $this->version); + $borderDiagonalColor = Xls\Color::map($diagonal->colorIndex, $this->palette, $this->version); $diagonal->getColor()->setRGB($borderDiagonalColor['rgb']); } } @@ -764,7 +764,7 @@ class Excel5 extends BaseReader implements IReader // treat MSODRAWINGGROUP records, workbook-level Escher if (!$this->readDataOnly && $this->drawingGroupData) { $escherWorkbook = new \PhpOffice\PhpSpreadsheet\Shared\Escher(); - $reader = new Excel5\Escher($escherWorkbook); + $reader = new Xls\Escher($escherWorkbook); $escherWorkbook = $reader->load($this->drawingGroupData); } @@ -982,7 +982,7 @@ class Excel5 extends BaseReader implements IReader // treat MSODRAWING records, sheet-level Escher if (!$this->readDataOnly && $this->drawingData) { $escherWorksheet = new \PhpOffice\PhpSpreadsheet\Shared\Escher(); - $reader = new Excel5\Escher($escherWorksheet); + $reader = new Xls\Escher($escherWorksheet); $escherWorksheet = $reader->load($this->drawingData); // get all spContainers in one long array, so they can be mapped to OBJ records @@ -1009,12 +1009,12 @@ class Excel5 extends BaseReader implements IReader $endOffsetX = $spContainer->getEndOffsetX(); $endOffsetY = $spContainer->getEndOffsetY(); - $width = \PhpOffice\PhpSpreadsheet\Shared\Excel5::getDistanceX($this->phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); - $height = \PhpOffice\PhpSpreadsheet\Shared\Excel5::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); + $width = \PhpOffice\PhpSpreadsheet\Shared\Xls::getDistanceX($this->phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); + $height = \PhpOffice\PhpSpreadsheet\Shared\Xls::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); // calculate offsetX and offsetY of the shape - $offsetX = $startOffsetX * \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, $startColumn) / 1024; - $offsetY = $startOffsetY * \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $startRow) / 256; + $offsetX = $startOffsetX * \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, $startColumn) / 1024; + $offsetY = $startOffsetY * \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $startRow) / 256; switch ($obj['otObjType']) { case 0x19: @@ -1711,7 +1711,7 @@ class Excel5 extends BaseReader implements IReader * @param int Block for which to create decrypto * @param string $valContext MD5 context state * - * @return Excel5\RC4 + * @return Xls\RC4 */ private function makeKey($block, $valContext) { @@ -1729,12 +1729,12 @@ class Excel5 extends BaseReader implements IReader $pwarray[9] = "\x80"; $pwarray[56] = "\x48"; - $md5 = new Excel5\MD5(); + $md5 = new Xls\MD5(); $md5->add($pwarray); $s = $md5->getContext(); - return new Excel5\RC4($s); + return new Xls\RC4($s); } /** @@ -1760,7 +1760,7 @@ class Excel5 extends BaseReader implements IReader $pwarray[2 * $i] = chr(0x80); $pwarray[56] = chr(($i << 4) & 0xff); - $md5 = new Excel5\MD5(); + $md5 = new Xls\MD5(); $md5->add($pwarray); $mdContext1 = $md5->getContext(); @@ -2147,19 +2147,19 @@ class Excel5 extends BaseReader implements IReader // offset: 10; size: 4; Cell border lines and background area // bit: 3-0; mask: 0x0000000F; left style - if ($bordersLeftStyle = Excel5\Style\Border::lookup((0x0000000F & self::getInt4d($recordData, 10)) >> 0)) { + if ($bordersLeftStyle = Xls\Style\Border::lookup((0x0000000F & self::getInt4d($recordData, 10)) >> 0)) { $objStyle->getBorders()->getLeft()->setBorderStyle($bordersLeftStyle); } // bit: 7-4; mask: 0x000000F0; right style - if ($bordersRightStyle = Excel5\Style\Border::lookup((0x000000F0 & self::getInt4d($recordData, 10)) >> 4)) { + if ($bordersRightStyle = Xls\Style\Border::lookup((0x000000F0 & self::getInt4d($recordData, 10)) >> 4)) { $objStyle->getBorders()->getRight()->setBorderStyle($bordersRightStyle); } // bit: 11-8; mask: 0x00000F00; top style - if ($bordersTopStyle = Excel5\Style\Border::lookup((0x00000F00 & self::getInt4d($recordData, 10)) >> 8)) { + if ($bordersTopStyle = Xls\Style\Border::lookup((0x00000F00 & self::getInt4d($recordData, 10)) >> 8)) { $objStyle->getBorders()->getTop()->setBorderStyle($bordersTopStyle); } // bit: 15-12; mask: 0x0000F000; bottom style - if ($bordersBottomStyle = Excel5\Style\Border::lookup((0x0000F000 & self::getInt4d($recordData, 10)) >> 12)) { + if ($bordersBottomStyle = Xls\Style\Border::lookup((0x0000F000 & self::getInt4d($recordData, 10)) >> 12)) { $objStyle->getBorders()->getBottom()->setBorderStyle($bordersBottomStyle); } // bit: 22-16; mask: 0x007F0000; left color @@ -2195,12 +2195,12 @@ class Excel5 extends BaseReader implements IReader $objStyle->getBorders()->getDiagonal()->colorIndex = (0x001FC000 & self::getInt4d($recordData, 14)) >> 14; // bit: 24-21; mask: 0x01E00000; diagonal style - if ($bordersDiagonalStyle = Excel5\Style\Border::lookup((0x01E00000 & self::getInt4d($recordData, 14)) >> 21)) { + if ($bordersDiagonalStyle = Xls\Style\Border::lookup((0x01E00000 & self::getInt4d($recordData, 14)) >> 21)) { $objStyle->getBorders()->getDiagonal()->setBorderStyle($bordersDiagonalStyle); } // bit: 31-26; mask: 0xFC000000 fill pattern - if ($fillType = Excel5\Style\FillPattern::lookup((0xFC000000 & self::getInt4d($recordData, 14)) >> 26)) { + if ($fillType = Xls\Style\FillPattern::lookup((0xFC000000 & self::getInt4d($recordData, 14)) >> 26)) { $objStyle->getFill()->setFillType($fillType); } // offset: 18; size: 2; pattern and background colour @@ -2242,10 +2242,10 @@ class Excel5 extends BaseReader implements IReader $objStyle->getFill()->endcolorIndex = (0x00003F80 & $borderAndBackground) >> 7; // bit: 21-16; mask: 0x003F0000; fill pattern - $objStyle->getFill()->setFillType(Excel5\Style\FillPattern::lookup((0x003F0000 & $borderAndBackground) >> 16)); + $objStyle->getFill()->setFillType(Xls\Style\FillPattern::lookup((0x003F0000 & $borderAndBackground) >> 16)); // bit: 24-22; mask: 0x01C00000; bottom line style - $objStyle->getBorders()->getBottom()->setBorderStyle(Excel5\Style\Border::lookup((0x01C00000 & $borderAndBackground) >> 22)); + $objStyle->getBorders()->getBottom()->setBorderStyle(Xls\Style\Border::lookup((0x01C00000 & $borderAndBackground) >> 22)); // bit: 31-25; mask: 0xFE000000; bottom line color $objStyle->getBorders()->getBottom()->colorIndex = (0xFE000000 & $borderAndBackground) >> 25; @@ -2254,13 +2254,13 @@ class Excel5 extends BaseReader implements IReader $borderLines = self::getInt4d($recordData, 12); // bit: 2-0; mask: 0x00000007; top line style - $objStyle->getBorders()->getTop()->setBorderStyle(Excel5\Style\Border::lookup((0x00000007 & $borderLines) >> 0)); + $objStyle->getBorders()->getTop()->setBorderStyle(Xls\Style\Border::lookup((0x00000007 & $borderLines) >> 0)); // bit: 5-3; mask: 0x00000038; left line style - $objStyle->getBorders()->getLeft()->setBorderStyle(Excel5\Style\Border::lookup((0x00000038 & $borderLines) >> 3)); + $objStyle->getBorders()->getLeft()->setBorderStyle(Xls\Style\Border::lookup((0x00000038 & $borderLines) >> 3)); // bit: 8-6; mask: 0x000001C0; right line style - $objStyle->getBorders()->getRight()->setBorderStyle(Excel5\Style\Border::lookup((0x000001C0 & $borderLines) >> 6)); + $objStyle->getBorders()->getRight()->setBorderStyle(Xls\Style\Border::lookup((0x000001C0 & $borderLines) >> 6)); // bit: 15-9; mask: 0x0000FE00; top line color index $objStyle->getBorders()->getTop()->colorIndex = (0x0000FE00 & $borderLines) >> 9; @@ -3831,7 +3831,7 @@ class Excel5 extends BaseReader implements IReader && (ord($recordData{13}) == 255)) { // Error formula. Error code is in +2 $dataType = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ERROR; - $value = Excel5\ErrorCode::lookup(ord($recordData{8})); + $value = Xls\ErrorCode::lookup(ord($recordData{8})); } elseif ((ord($recordData{6}) == 3) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { @@ -3974,7 +3974,7 @@ class Excel5 extends BaseReader implements IReader $cell->setValueExplicit($value, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_BOOL); break; case 1: // error type - $value = Excel5\ErrorCode::lookup($boolErr); + $value = Xls\ErrorCode::lookup($boolErr); // add cell value $cell->setValueExplicit($value, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_ERROR); @@ -4817,7 +4817,7 @@ class Excel5 extends BaseReader implements IReader case 0x14: // offset: 16; size: 2; color index for sheet tab $colorIndex = self::getInt2d($recordData, 16); - $color = Excel5\Color::map($colorIndex, $this->palette, $this->version); + $color = Xls\Color::map($colorIndex, $this->palette, $this->version); $this->phpSheet->getTabColor()->setRGB($color['rgb']); break; case 0x28: @@ -5550,7 +5550,7 @@ class Excel5 extends BaseReader implements IReader // offset: 1; size: 1; error code $name = 'tErr'; $size = 2; - $data = Excel5\ErrorCode::lookup(ord($formulaData[1])); + $data = Xls\ErrorCode::lookup(ord($formulaData[1])); break; case 0x1D: // boolean // offset: 1; size: 1; 0 = false, 1 = true; @@ -7025,7 +7025,7 @@ class Excel5 extends BaseReader implements IReader break; default: // TODO: external sheet support - throw new Exception('Excel5 reader only supports internal sheets in fomulas'); + throw new Exception('Xls reader only supports internal sheets in fomulas'); break; } } @@ -7111,7 +7111,7 @@ class Excel5 extends BaseReader implements IReader break; case 0x10: // error code // offset: 1; size: 1; error code - $value = Excel5\ErrorCode::lookup(ord($valueData[1])); + $value = Xls\ErrorCode::lookup(ord($valueData[1])); $size = 9; break; } diff --git a/src/PhpSpreadsheet/Reader/Excel5/Color.php b/src/PhpSpreadsheet/Reader/Xls/Color.php similarity index 86% rename from src/PhpSpreadsheet/Reader/Excel5/Color.php rename to src/PhpSpreadsheet/Reader/Xls/Color.php index 3a61f8f2..2db53e83 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Color.php +++ b/src/PhpSpreadsheet/Reader/Xls/Color.php @@ -1,6 +1,6 @@ pos < $this->dataSize) { // offset: 2; size: 2: Record Type - $fbt = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos + 2); + $fbt = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos + 2); switch ($fbt) { case self::DGGCONTAINER: @@ -172,15 +172,15 @@ class Escher private function readDefault() { // offset 0; size: 2; recVer and recInstance - $verInstance = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos); + $verInstance = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos); // offset: 2; size: 2: Record Type - $fbt = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos + 2); + $fbt = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos + 2); // bit: 0-3; mask: 0x000F; recVer $recVer = (0x000F & $verInstance) >> 0; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -192,7 +192,7 @@ class Escher */ private function readDggContainer() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -210,7 +210,7 @@ class Escher */ private function readDgg() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -222,7 +222,7 @@ class Escher */ private function readBstoreContainer() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -243,9 +243,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -267,16 +267,16 @@ class Escher $rgbUid = substr($recordData, 2, 16); // offset: 18; size: 2; tag - $tag = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 18); + $tag = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 18); // offset: 20; size: 4; size of BLIP in bytes - $size = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($recordData, 20); + $size = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($recordData, 20); // offset: 24; size: 4; number of references to this BLIP - $cRef = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($recordData, 24); + $cRef = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($recordData, 24); // offset: 28; size: 4; MSOFO file offset - $foDelay = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($recordData, 28); + $foDelay = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($recordData, 28); // offset: 32; size: 1; unused1 $unused1 = ord($recordData{32}); @@ -297,7 +297,7 @@ class Escher $blipData = substr($recordData, 36 + $cbName); // record is a container, read contents - $reader = new \PhpOffice\PhpSpreadsheet\Reader\Excel5\Escher($BSE); + $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls\Escher($BSE); $reader->load($blipData); } @@ -309,9 +309,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -350,9 +350,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -391,9 +391,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -410,9 +410,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -424,7 +424,7 @@ class Escher */ private function readSplitMenuColors() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -436,7 +436,7 @@ class Escher */ private function readDgContainer() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -445,7 +445,7 @@ class Escher // record is a container, read contents $dgContainer = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer(); $this->object->setDgContainer($dgContainer); - $reader = new \PhpOffice\PhpSpreadsheet\Reader\Excel5\Escher($dgContainer); + $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls\Escher($dgContainer); $escher = $reader->load($recordData); } @@ -454,7 +454,7 @@ class Escher */ private function readDg() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -468,7 +468,7 @@ class Escher { // context is either context DgContainer or SpgrContainer - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -494,7 +494,7 @@ class Escher */ private function readSpContainer() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // add spContainer to spgrContainer @@ -514,7 +514,7 @@ class Escher */ private function readSpgr() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -529,9 +529,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -546,9 +546,9 @@ class Escher // offset: 0; size: 2; recVer and recInstance // bit: 4-15; mask: 0xFFF0; recInstance - $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($this->data, $this->pos)) >> 4; + $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -560,35 +560,35 @@ class Escher */ private function readClientAnchor() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record $this->pos += 8 + $length; // offset: 2; size: 2; upper-left corner column index (0-based) - $c1 = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 2); + $c1 = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 2); // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width - $startOffsetX = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 4); + $startOffsetX = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 4); // offset: 6; size: 2; upper-left corner row index (0-based) - $r1 = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 6); + $r1 = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 6); // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height - $startOffsetY = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 8); + $startOffsetY = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 8); // offset: 10; size: 2; bottom-right corner column index (0-based) - $c2 = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 10); + $c2 = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 10); // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width - $endOffsetX = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 12); + $endOffsetX = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 12); // offset: 14; size: 2; bottom-right corner row index (0-based) - $r2 = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 14); + $r2 = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 14); // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height - $endOffsetY = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($recordData, 16); + $endOffsetY = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 16); // set the start coordinates $this->object->setStartCoordinates(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($c1) . ($r1 + 1)); @@ -614,7 +614,7 @@ class Escher */ private function readClientData() { - $length = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($this->data, $this->pos + 4); + $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -637,7 +637,7 @@ class Escher $fopte = substr($data, 6 * $i, 6); // offset: 0; size: 2; opid - $opid = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt2d($fopte, 0); + $opid = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($fopte, 0); // bit: 0-13; mask: 0x3FFF; opid.opid $opidOpid = (0x3FFF & $opid) >> 0; @@ -649,7 +649,7 @@ class Escher $opidFComplex = (0x8000 & $opid) >> 15; // offset: 2; size: 4; the value for this property - $op = \PhpOffice\PhpSpreadsheet\Reader\Excel5::getInt4d($fopte, 2); + $op = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($fopte, 2); if ($opidFComplex) { $complexData = substr($splicedComplexData, 0, $op); diff --git a/src/PhpSpreadsheet/Reader/Excel5/MD5.php b/src/PhpSpreadsheet/Reader/Xls/MD5.php similarity index 99% rename from src/PhpSpreadsheet/Reader/Excel5/MD5.php rename to src/PhpSpreadsheet/Reader/Xls/MD5.php index 51ab4271..f473ee14 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/MD5.php +++ b/src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -1,6 +1,6 @@ spreadsheet = $spreadsheet; - $this->parser = new Excel5\Parser(); + $this->parser = new Xls\Parser(); } /** @@ -122,12 +122,12 @@ class Excel5 extends BaseWriter implements IWriter $this->colors = []; // Initialise workbook writer - $this->writerWorkbook = new Excel5\Workbook($this->spreadsheet, $this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser); + $this->writerWorkbook = new Xls\Workbook($this->spreadsheet, $this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser); // Initialise worksheet writers $countSheets = $this->spreadsheet->getSheetCount(); for ($i = 0; $i < $countSheets; ++$i) { - $this->writerWorksheets[$i] = new Excel5\Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->preCalculateFormulas, $this->spreadsheet->getSheet($i)); + $this->writerWorksheets[$i] = new Xls\Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->preCalculateFormulas, $this->spreadsheet->getSheet($i)); } // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook. @@ -222,7 +222,7 @@ class Excel5 extends BaseWriter implements IWriter * @deprecated * @param string $pValue Temporary storage directory * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception when directory does not exist - * @return \PhpOffice\PhpSpreadsheet\Writer\Excel5 + * @return \PhpOffice\PhpSpreadsheet\Writer\Xls */ public function setTempDir($pValue = '') { @@ -311,7 +311,7 @@ class Excel5 extends BaseWriter implements IWriter $width = $drawing->getWidth(); $height = $drawing->getHeight(); - $twoAnchor = \PhpOffice\PhpSpreadsheet\Shared\Excel5::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height); + $twoAnchor = \PhpOffice\PhpSpreadsheet\Shared\Xls::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height); $spContainer->setStartCoordinates($twoAnchor['startCoordinates']); $spContainer->setStartOffsetX($twoAnchor['startOffsetX']); diff --git a/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php similarity index 99% rename from src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php rename to src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php index 9cab3be6..ce145006 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php @@ -1,6 +1,6 @@ fontWriters); $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1; - $fontWriter = new \PhpOffice\PhpSpreadsheet\Writer\Excel5\Font($font); + $fontWriter = new \PhpOffice\PhpSpreadsheet\Writer\Xls\Font($font); $fontWriter->setColorIndex($this->addColor($font->getColor()->getRGB())); $this->fontWriters[] = $fontWriter; @@ -1401,7 +1401,7 @@ class Workbook extends BIFFwriter { // write the Escher stream if necessary if (isset($this->escher)) { - $writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel5\Escher($this->escher); + $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls\Escher($this->escher); $data = $writer->close(); $record = 0x00EB; diff --git a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php similarity index 98% rename from src/PhpSpreadsheet/Writer/Excel5/Worksheet.php rename to src/PhpSpreadsheet/Writer/Xls/Worksheet.php index b1858a04..4eb871b8 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -1,6 +1,6 @@ = \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_start))) { + if ($x1 >= \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_start))) { $x1 = 0; } - if ($y1 >= \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1)) { + if ($y1 >= \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_start + 1)) { $y1 = 0; } @@ -2383,38 +2383,38 @@ class Worksheet extends BIFFwriter $height = $height + $y1 - 1; // Subtract the underlying cell widths to find the end cell of the image - while ($width >= \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end))) { - $width -= \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)); + while ($width >= \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end))) { + $width -= \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)); ++$col_end; } // Subtract the underlying cell heights to find the end cell of the image - while ($height >= \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1)) { - $height -= \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1); + while ($height >= \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_end + 1)) { + $height -= \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_end + 1); ++$row_end; } // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell // with zero eight or width. // - if (\PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) == 0) { + if (\PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) == 0) { return; } - if (\PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) == 0) { + if (\PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) == 0) { return; } - if (\PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) == 0) { + if (\PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_start + 1) == 0) { return; } - if (\PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) == 0) { + if (\PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_end + 1) == 0) { return; } // Convert the pixel values to the percentage value expected by Excel - $x1 = $x1 / \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) * 1024; - $y1 = $y1 / \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) * 256; - $x2 = $width / \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object - $y2 = $height / \PhpOffice\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object + $x1 = $x1 / \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) * 1024; + $y1 = $y1 / \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_start + 1) * 256; + $x2 = $width / \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $y2 = $height / \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object $this->writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2); } @@ -2656,7 +2656,7 @@ class Worksheet extends BIFFwriter { // write the Escher stream if necessary if (isset($this->escher)) { - $writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel5\Escher($this->escher); + $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls\Escher($this->escher); $data = $writer->close(); $spOffsets = $writer->getSpOffsets(); $spTypes = $writer->getSpTypes(); diff --git a/src/PhpSpreadsheet/Writer/Excel5/Xf.php b/src/PhpSpreadsheet/Writer/Xls/Xf.php similarity index 99% rename from src/PhpSpreadsheet/Writer/Excel5/Xf.php rename to src/PhpSpreadsheet/Writer/Xls/Xf.php index 54b5b6ad..9c5b3b8b 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Xf.php +++ b/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -1,6 +1,6 @@