| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use PhpOffice\PhpSpreadsheet\IOFactory; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require __DIR__ . '/../Header.php'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $inputFileType = 'Xls'; | 
					
						
							|  |  |  | $inputFileName = __DIR__ . '/sampleData/example1.xls'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Create a new Reader of the type defined in $inputFileType
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $reader = IOFactory::createReader($inputFileType); | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Load $inputFileName to a PhpSpreadsheet Object
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $spreadsheet = $reader->load($inputFileName); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the document's creator property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $creator = $spreadsheet->getProperties()->getCreator(); | 
					
						
							|  |  |  | $helper->log('<b>Document Creator: </b>' . $creator); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the Date when the workbook was created (as a PHP timestamp value)
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $creationDatestamp = $spreadsheet->getProperties()->getCreated(); | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Format the date and time using the standard PHP date() function
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $creationDate = date('l, d<\s\up>S</\s\up> F Y', $creationDatestamp); | 
					
						
							|  |  |  | $creationTime = date('g:i A', $creationDatestamp); | 
					
						
							|  |  |  | $helper->log('<b>Created On: </b>' . $creationDate . ' at ' . $creationTime); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the name of the last person to modify this workbook
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $modifiedBy = $spreadsheet->getProperties()->getLastModifiedBy(); | 
					
						
							|  |  |  | $helper->log('<b>Last Modified By: </b>' . $modifiedBy); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the Date when the workbook was last modified (as a PHP timestamp value)
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $modifiedDatestamp = $spreadsheet->getProperties()->getModified(); | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Format the date and time using the standard PHP date() function
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $modifiedDate = date('l, d<\s\up>S</\s\up> F Y', $modifiedDatestamp); | 
					
						
							|  |  |  | $modifiedTime = date('g:i A', $modifiedDatestamp); | 
					
						
							|  |  |  | $helper->log('<b>Last Modified On: </b>' . $modifiedDate . ' at ' . $modifiedTime); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook title property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $workbookTitle = $spreadsheet->getProperties()->getTitle(); | 
					
						
							|  |  |  | $helper->log('<b>Title: </b>' . $workbookTitle); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook description property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $description = $spreadsheet->getProperties()->getDescription(); | 
					
						
							|  |  |  | $helper->log('<b>Description: </b>' . $description); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook subject property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $subject = $spreadsheet->getProperties()->getSubject(); | 
					
						
							|  |  |  | $helper->log('<b>Subject: </b>' . $subject); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook keywords property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $keywords = $spreadsheet->getProperties()->getKeywords(); | 
					
						
							|  |  |  | $helper->log('<b>Keywords: </b>' . $keywords); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook category property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $category = $spreadsheet->getProperties()->getCategory(); | 
					
						
							|  |  |  | $helper->log('<b>Category: </b>' . $category); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook company property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $company = $spreadsheet->getProperties()->getCompany(); | 
					
						
							|  |  |  | $helper->log('<b>Company: </b>' . $company); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-01 11:07:04 +00:00
										 |  |  | // Read the workbook manager property
 | 
					
						
							| 
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 |  |  | $manager = $spreadsheet->getProperties()->getManager(); | 
					
						
							|  |  |  | $helper->log('<b>Manager: </b>' . $manager); | 
					
						
							|  |  |  | $s = new \PhpOffice\PhpSpreadsheet\Helper\Sample(); |