 c47b407e39
			
		
	
	
		c47b407e39
		
	
	
	
	
		
			
			Replace default gridlines with different style. Usable in PDF as well as HTML. Documentation mentioned use of setUseBOM with Html, but that method does not exist, and there is no real reason to support it. Removed it from documentation.
		
			
				
	
	
		
			26 lines
		
	
	
		
			856 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			856 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
 | |
| use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
 | |
| 
 | |
| require __DIR__ . '/../Header.php';
 | |
| $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
 | |
| 
 | |
| $helper->log('Hide grid lines');
 | |
| $spreadsheet->getActiveSheet()->setShowGridLines(false);
 | |
| 
 | |
| $helper->log('Set orientation to landscape');
 | |
| $spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
 | |
| $spreadsheet->setActiveSheetIndex(0)->setPrintGridlines(true);
 | |
| 
 | |
| function changeGridlines(string $html): string
 | |
| {
 | |
|     return str_replace('{border: 1px solid black;}', '{border: 2px dashed red;}', $html);
 | |
| }
 | |
| 
 | |
| $helper->log('Write to Mpdf');
 | |
| $writer = new Mpdf($spreadsheet);
 | |
| $filename = $helper->getFileName('21a_Pdf_mpdf.xlsx', 'pdf');
 | |
| $writer->setEditHtmlCallback('changeGridlines');
 | |
| $writer->save($filename);
 |