Md. Sahadat Hossain
Md. Sahadat Hossain

Reputation: 3236

Set Paper width in laravel-excel

I have data with large amount if columns. Now I want to export it in excel and pdf. I use Maatwebsite/Laravel-Excel package for that. Everything is working fine. But when I export to pdf it crops some column due to paper size.

Now I want to increase paper size But I did not found how to increase paper size.

Here is the code I have tried to increase paper size.

$sheet->setOrientation('landscape');
$sheet->setPaperSize(1);

Upvotes: 1

Views: 2883

Answers (1)

Ali Beshir
Ali Beshir

Reputation: 432

You Can Use A3 Paper Size Like This

$sheet->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3)

And Use One Of the constants in PHPExcel_Worksheet_PageSetup listed here if You Want Another Paper Sizes: http://www.osakac.ac.jp/labs/koeda/tmp/phpexcel/Documentation/API/PHPExcel_Worksheet/PHPExcel_Worksheet_PageSetup.html

and Don't Forget to use PHPExcel_Worksheet_PageSetup Like This:

namespace YourNamespace;

use PHPExcel_Worksheet_PageSetup;

class YourClass {


}

I Hope That Helped You .

Upvotes: 1

Related Questions