2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<?php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-18 14:12:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								use PhpOffice\PhpSpreadsheet\Spreadsheet;
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-29 08:39:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								use PhpOffice\PhpSpreadsheet\Style\Style;
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								require __DIR__ . '/../Header.php';
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$helper->log('Create new Spreadsheet object');
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								$spreadsheet = new Spreadsheet();
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$worksheet = $spreadsheet->getActiveSheet();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$helper->log('Create styles array');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$styles = [];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								for ($i = 0; $i < 10; ++$i) {
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $style = new Style();
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $style->getFont()->setSize($i + 4);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $styles[] = $style;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$helper->log('Add data (begin)');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$t = microtime(true);
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-25 10:26:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								for ($col = 1; $col <= 50; ++$col) {
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    for ($row = 0; $row < 100; ++$row) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $str = ($row + $col);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $style = $styles[$row % 10];
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-18 14:12:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        $coord = Coordinate::stringFromColumnIndex($col) . ($row + 1);
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $worksheet->setCellValue($coord, $str);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $worksheet->duplicateStyle($style, $coord);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$d = microtime(true) - $t;
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-01 08:48:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								$helper->log('Add data (end) . time: ' . round($d . 2) . ' s');
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 16:15:54 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Save
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$helper->write($spreadsheet, __FILE__);
							 |