0

How to set page border on PHPExcel. Couldn't find it ? This border will be appear before another page created.

and the result after border applied on bottom. After Page Border Applied

I've tried using this

$excel->getDefaultStyle()->applyFromArray($styleArray);

$excel->getActiveSheet()->getStyle( 'A1:' . $excel->getActiveSheet()->getHighestColumn() . $excel->getActiveSheet()->getHighestRow() )->applyFromArray($styleArray);

But no luck... bottom border on page not created...

Thank you very much...

1 Answer 1

0

Page border settings are defined through the worksheet's Page Margins object, accessed using $objPHPExcel->getActiveSheet()->getPageMargins(). There is a section of the developer documentation dedicated to this subject, entitled "Page margins"

$objPHPExcel->getActiveSheet()
    ->getPageMargins()
    ->setTop(1)
    ->setRight(0.75)
    ->setLeft(0.75)
    ->setBottom(1.25);

Note that this only applies for the Excel2007 and Excel5 Writers

6
  • No It's not working... bottom border before next page not showup... Maybe because I'm using LibreOffice Calc that has feature to bottom border setting... and Ms Excel doesn't have it.... Is it ? Jan 21, 2015 at 8:09
  • So what is a page border then? Please explain exactly what you understand by page border.... as far as MS Excel (and PHPExcel) is concerned, it's a blank section around the edges of the printed page when the worksheet is printed out on paper
    – Mark Baker
    Jan 21, 2015 at 8:33
  • this Spreadsheet created by PHPExcel i.imgur.com/H9RXSHJ.png .... I want there's a border bottom like this i.imgur.com/hne9N9H.png . .. I created this using libreOffice Calc. And I don't know how to make a border like this using PHPExcel ( I call it Border on bottom page) .. Jan 21, 2015 at 8:39
  • If it's not an option that's available in MS Excel itself, then it probably won't be supported.... I can only really work with the options available in the OfficeOpenXML or BIFF format specifications, though I can take a look at OASIS to see how it's managed there
    – Mark Baker
    Jan 21, 2015 at 9:03
  • Thank you for your answer ... I've been looking this... but I think I've to count on rows and then marking a border on those cell... LOL... That's my solution... but when users using another printer type, it could be worst... LOL... Jan 21, 2015 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.