F
F
Forge01002016-08-25 14:46:23
PHP
Forge0100, 2016-08-25 14:46:23

How to make table width fixed (PHPExcel + mPDF)?

The problem is that I'm generating my PDF directly from the XLS file.
I need to leave the table in a fixed form so that all columns that do not fit on the page are hidden and the text is reduced as in Excel cells.
Here's how it is now:
7898434764b64ce4a74b8cf2d6035014.pngAnd here's how it should come out:
4717e91cb5ba45838ad3ffc63c7eb7c7.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Novikov, 2016-08-25
@paulfcdd

For example like this - $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);

M
MassTek, 2016-08-25
@MassTek

For columns

$objPHPExcel->getActiveSheet()
        ->getColumnDimension('B')
        ->setWidth(15);

For a specific range of columns
for ($i = 2; $i <= $mcols; $i++) {
        $objPHPExcel->getActiveSheet()
            ->getColumnDimensionByColumn($i)
            ->setWidth(15);
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question