| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 |  |  | use PhpOffice\PhpSpreadsheet\IOFactory; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | error_reporting(E_ALL); | 
					
						
							|  |  |  | set_time_limit(0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | date_default_timezone_set('Europe/London'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | <html> | 
					
						
							|  |  |  | <head> | 
					
						
							|  |  |  | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-24 13:09:32 +00:00
										 |  |  | <title>PhpSpreadsheet Reading WorkBook Data Example #02</title>
 | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | </head> | 
					
						
							|  |  |  | <body> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-24 13:09:32 +00:00
										 |  |  | <h1>PhpSpreadsheet Reading WorkBook Data Example #02</h1>
 | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | <h2>Read a list of Custom Properties for a WorkBook</h2> | 
					
						
							|  |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-24 13:09:32 +00:00
										 |  |  | require_once __DIR__ . '/../../../src/Bootstrap.php'; | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-06 11:39:10 +00:00
										 |  |  | $inputFileType = 'Xlsx'; | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | $inputFileName = './sampleData/example1.xlsx'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-27 09:54:51 +00:00
										 |  |  | /*  Create a new Reader of the type defined in $inputFileType  **/ | 
					
						
							| 
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 |  |  | $reader = IOFactory::createReader($inputFileType); | 
					
						
							| 
									
										
										
										
											2017-03-24 13:09:32 +00:00
										 |  |  | /*  Load $inputFileName to a PhpSpreadsheet Object  **/ | 
					
						
							| 
									
										
										
										
											2016-12-03 13:32:54 +00:00
										 |  |  | $spreadsheet = $reader->load($inputFileName); | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | echo '<hr />'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-27 09:54:51 +00:00
										 |  |  | /*  Read an array list of any custom properties for this document  **/ | 
					
						
							| 
									
										
										
										
											2016-11-27 15:51:44 +00:00
										 |  |  | $customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | echo '<b>Custom Property names: </b><br />'; | 
					
						
							| 
									
										
										
										
											2016-11-27 09:54:51 +00:00
										 |  |  | foreach ($customPropertyList as $customPropertyName) { | 
					
						
							| 
									
										
										
										
											2017-01-05 03:14:44 +00:00
										 |  |  |     echo $customPropertyName, '<br />'; | 
					
						
							| 
									
										
										
										
											2010-10-20 21:55:40 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | <body> | 
					
						
							|  |  |  | </html> |