diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php new file mode 100644 index 00000000..4f8dfdf7 --- /dev/null +++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php @@ -0,0 +1,93 @@ + + + + + +PHPExcel Reading WorkBook Data Example #01 + + + + +

PHPExcel Reading WorkBook Data Example #01

+

Read the WorkBook Properties

+load($inputFileName); + + +echo '
'; + +/** Read the document's creator property **/ +$creator = $objPHPExcel->getProperties()->getCreator(); +echo 'Document Creator: ',$creator,'
'; + +/** Read the Date when the workbook was created (as a PHP timestamp value) **/ +$creationDatestamp = $objPHPExcel->getProperties()->getCreated(); +/** Format the date and time using the standard PHP date() function **/ +$creationDate = date('l, d<\s\up>S F Y',$creationDatestamp); +$creationTime = date('g:i A',$creationDatestamp); +echo 'Created On: ',$creationDate,' at ',$creationTime,'
'; + +/** Read the name of the last person to modify this workbook **/ +$modifiedBy = $objPHPExcel->getProperties()->getLastModifiedBy(); +echo 'Last Modified By: ',$modifiedBy,'
'; + +/** Read the Date when the workbook was last modified (as a PHP timestamp value) **/ +$modifiedDatestamp = $objPHPExcel->getProperties()->getModified(); +/** Format the date and time using the standard PHP date() function **/ +$modifiedDate = date('l, d<\s\up>S F Y',$modifiedDatestamp); +$modifiedTime = date('g:i A',$modifiedDatestamp); +echo 'Last Modified On: ',$modifiedDate,' at ',$modifiedTime,'
'; + +/** Read the workbook title property **/ +$workbookTitle = $objPHPExcel->getProperties()->getTitle(); +echo 'Title: ',$workbookTitle,'
'; + +/** Read the workbook description property **/ +$description = $objPHPExcel->getProperties()->getDescription(); +echo 'Description: ',$description,'
'; + +/** Read the workbook subject property **/ +$subject = $objPHPExcel->getProperties()->getSubject(); +echo 'Subject: ',$subject,'
'; + +/** Read the workbook keywords property **/ +$keywords = $objPHPExcel->getProperties()->getKeywords(); +echo 'Keywords: ',$keywords,'
'; + +/** Read the workbook category property **/ +$category = $objPHPExcel->getProperties()->getCategory(); +echo 'Category: ',$category,'
'; + +/** Read the workbook company property **/ +$company = $objPHPExcel->getProperties()->getCompany(); +echo 'Company: ',$company,'
'; + +/** Read the workbook manager property **/ +$manager = $objPHPExcel->getProperties()->getManager(); +echo 'Manager: ',$manager,'
'; + + +?> + + diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader02.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader02.php new file mode 100644 index 00000000..b8c359d3 --- /dev/null +++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader02.php @@ -0,0 +1,52 @@ + + + + + +PHPExcel Reading WorkBook Data Example #02 + + + + +

PHPExcel Reading WorkBook Data Example #02

+

Read a list of Custom Properties for a WorkBook

+load($inputFileName); + + +echo '
'; + +/** Read an array list of any custom properties for this document **/ +$customPropertyList = $objPHPExcel->getProperties()->getCustomProperties(); + +echo 'Custom Property names:
'; +foreach($customPropertyList as $customPropertyName) { + echo $customPropertyName,'
'; +} + + + +?> + + diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader03.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader03.php new file mode 100644 index 00000000..8fb350d4 --- /dev/null +++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader03.php @@ -0,0 +1,80 @@ + + + + + +PHPExcel Reading WorkBook Data Example #03 + + + + +

PHPExcel Reading WorkBook Data Example #03

+

Read Custom Property Values for a WorkBook

+load($inputFileName); + + +echo '
'; + +/** Read an array list of any custom properties for this document **/ +$customPropertyList = $objPHPExcel->getProperties()->getCustomProperties(); + +echo 'Custom Properties:
'; +/** Loop through the list of custom properties **/ +foreach($customPropertyList as $customPropertyName) { + echo '',$customPropertyName,': '; + /** Retrieve the property value **/ + $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customPropertyName); + /** Retrieve the property type **/ + $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customPropertyName); + + /** Manipulate properties as appropriate for display purposes **/ + switch($propertyType) { + case 'i' : // integer + $propertyType = 'integer number'; + break; + case 'f' : // float + $propertyType = 'floating point number'; + break; + case 's' : // string + $propertyType = 'string'; + break; + case 'd' : // date + $propertyValue = date('l, d<\s\up>S F Y g:i A',$propertyValue); + $propertyType = 'date'; + break; + case 'b' : // boolean + $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE'; + $propertyType = 'boolean'; + break; + } + + echo $propertyValue,' (',$propertyType,')
'; +} + + + +?> + + diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php new file mode 100644 index 00000000..05ff6374 --- /dev/null +++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php @@ -0,0 +1,55 @@ + + + + + +PHPExcel Reading WorkBook Data Example #04 + + + + +

PHPExcel Reading WorkBook Data Example #04

+

Get a List of the Worksheets in a WorkBook

+load($inputFileName); + + +echo '
'; + +echo 'Reading the number of Worksheets in the WorkBook
'; +/** Use the PHPExcel object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */ +$sheetCount = $objPHPExcel->getSheetCount(); +echo 'There ',(($sheetCount == 1) ? 'is' : 'are'),' ',$sheetCount,' WorkSheet',(($sheetCount == 1) ? '' : 's'),' in the WorkBook

'; + +echo 'Reading the names of Worksheets in the WorkBook
'; +/** Use the PHPExcel object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */ +$sheetNames = $objPHPExcel->getSheetNames(); +foreach($sheetNames as $sheetIndex => $sheetName) { + echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"
'; +} + + +?> + + diff --git a/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xls b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xls new file mode 100644 index 00000000..0db0efdc Binary files /dev/null and b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xls differ diff --git a/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xlsx b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xlsx new file mode 100644 index 00000000..2224dd4f Binary files /dev/null and b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xlsx differ diff --git a/Documentation/Examples/Reading WorkBook Data/sampleData/example2.xls b/Documentation/Examples/Reading WorkBook Data/sampleData/example2.xls new file mode 100644 index 00000000..18bfcf47 Binary files /dev/null and b/Documentation/Examples/Reading WorkBook Data/sampleData/example2.xls differ