News

Multiple columns layout with PHPdocx

  • Jun 06, 2011

This information is outdated, please, refer to the modifyPageLayout method documentation for up to date info.
Do you need to create a Word document with more than a single column per page?
You can modify the number of columns as follows:


require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx();

$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' .
'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' .
'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' .
'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' .
'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ' .
'officia deserunt mollit anim id est laborum.';

$docx->addText($text);

$paramsPage = array(
'titlePage' => 1,
// Number of columns
'columns' => 3,
// Orientation of the paper. Could be 'Landscape'
'orient' => 'normal',
'top' => 4000,
'bottom' => 4000,
'right' => 4000,
'left' => 4000
);

$docx->createDocx('example_textcolumns', $paramsPage);