Skip to content

Multicolumn layout is not working. #2627

Open
@iedev1

Description

@iedev1

Describe the bug and add attachments

Adding a section with multiple columns has no effect on the resulting .docx.

E.g.

$phpWord->addSection( [
            'colsNum' => $columns,
            'colsSpace' => 1440,
            'breakType' => 'continuous',
]);

I tried removing "Compatibility Mode" via $phpWord->getCompatibility()->setOoxmlVersion(15); to no effect.

And running the Sample_05_Multicolumn.php example also doesn't work. Neither the docx, HTML or ODT files have multiple columns

Actual result from phpWord

phpWord - No Columns

Expected result

Word - Expected

Expected behavior

See the screenshot. I expect the document to have more than one column.

Steps to reproduce

Exactly as per https://github.com/PHPOffice/PHPWord/blob/master/samples/Sample_05_Multicolumn.php

    $phpWord = new \PhpOffice\PhpWord\PhpWord();

    // Remove 'compatibility mode'
    $phpWord->getCompatibility()->setOoxmlVersion(15);

    $filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
        'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. ' .
        'Donec vulputate iaculis metus, vel luctus dolor hendrerit ac. ' .
        'Suspendisse congue congue leo sed pellentesque.';

    // Normal
    $section = $phpWord->addSection();
    $section->addText('Normal paragraph. ' . $filler);

    // Two columns
    $section = $phpWord->addSection(array(
        'colsNum' => 2,
        'colsSpace' => 1440,
        'breakType' => 'continuous'));
    $section->addText('Two columns, one inch (1440 twips) spacing. ' . $filler);

    // Normal
    $section = $phpWord->addSection(array('breakType' => 'continuous'));
    $section->addText('Normal paragraph again. ' . $filler);

    // Three columns
    $section = $phpWord->addSection(array(
        'colsNum' => 3,
        'colsSpace' => 720,
        'breakType' => 'continuous'));
    $section->addText('Three columns, half inch (720 twips) spacing. ' . $filler);

    // Normal
    $section = $phpWord->addSection(array('breakType' => 'continuous'));
    $section->addText('Normal paragraph again.');

PHPWord version(s) where the bug happened

master

PHP version(s) where the bug happened

8.1

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions