PHPExcel设置打印区域
https://www.cnblogs.com/keketoloveme/p/16723337.html
方向和纸张尺寸:
1
2
3
4
5
6
| $objPHPExcel->getActiveSheet()
->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$objPHPExcel->getActiveSheet()
->getPageSetup()
->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
|
页边距:
1
2
3
4
5
6
7
8
| $objPHPExcel->getActiveSheet()
->getPageMargins()->setTop(1);
$objPHPExcel->getActiveSheet()
->getPageMargins()->setRight(0.75);
$objPHPExcel->getActiveSheet()
->getPageMargins()->setLeft(0.75);
$objPHPExcel->getActiveSheet()
->getPageMargins()->setBottom(1);
|
页眉和页脚:
1
2
3
4
5
6
| $objPHPExcel->getActiveSheet()
->getHeaderFooter()
->setOddHeader('&C&HPlease treat this document as confidential!');
$objPHPExcel->getActiveSheet()
->getHeaderFooter()
->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() .
|
打印机分页符:
1
2
| $objPHPExcel->getActiveSheet()
->setBreak( 'A10' , PHPExcel_Worksheet::BREAK_ROW );
|
显示网格线:
1
2
| $objPHPExcel->getActiveSheet()
->setShowGridlines(true);
|
将行/列设置为在每页的顶部/左侧重复
1
2
3
| $objPHPExcel->getActiveSheet()
->getPageSetup()
->setRowsToRepeatAtTopByStartAndEnd(1, 5);
|
设置打印区域:
1
2
3
| $objPHPExcel->getActiveSheet()
->getPageSetup()
->setPrintArea('A1:E5,G4:M20');
|