how to write a good multicolumn document using phpword

2k Views Asked by At

I've been using phpword to write documents but now I need to write my document in 2 columns. I have a collection of texts that I get in a loop. I realized you can use 'colsNum' attribute like this:

$section = $phpWord->addSection(['marginLeft'=> 850.39, 'marginRight' => 850.39, 'marginBottom' => 1190.55, 'marginTop' => 1190.55, 'pageSizeH' => 13606.29, 'pageSizeW'=> 9637.79, 'colsNum' =>2]);

This write the two columns perfectly but makes a pageBreak after every text and I want not to do the break. So I tried this:

$section = $phpWord->addSection(['marginLeft'=> 850.39, 'marginRight' => 850.39, 'marginBottom' => 1190.55, 'marginTop' => 1190.55, 'pageSizeH' => 13606.29, 'pageSizeW'=> 9637.79, 'colsNum' =>2, "breakType" => "continuous"]);

Adding the breakType now it fills the whole page without making a break but starts writing the first text on left column and in the middle of page continues writing the first text on right column. After that continues again on the second half of left column with the second text in the collection.

What I want is write the full left column and then to continue with right one.

Maybe that's not possible with phpword, I dont know. But I've been searching simple alternatives for make that in laravel without success.

1

There are 1 best solutions below

0
On

You need to add 'continuous':

$section = $phpWord->addSection(['breakType' => 'continuous', 'colsNum' => 2]);