Excel Horizontal

1

How can I do it so that, from the moment the Excel is downloaded and I open it, the orientation of the page is horizontal?

I tried to put this from the beginning of the code, but it does not work.

$objPHPExcel->getActiveSheet()->getPageSetup()->setHorizontalCentered(true);
$objPHPExcel->getActiveSheet()->getPageSetup()->setVerticalCentered(false);
    
asked by VirusDetected 27.12.2018 в 17:52
source

2 answers

0

Code to change the orientation of the sheet:

 $objPHPExcel->getActiveSheet()->getPageSetup()->setHorizontalCentered(true);

or

$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation("landscape");

To see the orientation of the Excel file, you should go to Vista . There you must select page layout or the View page breaks .

If the view is normal, you will not see changes.

You can also see the changes, if you try to print the sheet.

    
answered by 27.12.2018 / 18:15
source
1

What you should do is just establish the orientation of the page. With the code you are showing you are setting some printing options. The orientation of the page in horizontal would be something like:

$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);

For vertical , instead you use ORIENTATION_PORTRAIT

    
answered by 27.12.2018 в 18:11