Phpword: Add charts side by side

Created on 1 Aug 2017  路  1Comment  路  Source: PHPOffice/PHPWord

Hi everybody,

i don't know if this is the right place to ask, but is there a way to add charts side by side within a table or somewhat? I tried with textrun and cell containers, but you cannot add a chart to either one of these. If someone has an idea how to place them side by side, please let me know.

Thanks, diggamies


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Most helpful comment

@diggamies I would hack "vendor/phpoffice/phpword/src/PhpWord/Element/AbstractContainer.php" around line 282, allowing Table Cell's to contain a Chart:

            'Chart'         => array('Section', 'Cell'),

And then try to put your chart in a cell that is 4500 wide:

$phpWord->addSection()->addTable()->addRow()->addCell(4500)->addChart($type,[],[]);

If this works, maybe you can send a patch in?

>All comments

@diggamies I would hack "vendor/phpoffice/phpword/src/PhpWord/Element/AbstractContainer.php" around line 282, allowing Table Cell's to contain a Chart:

            'Chart'         => array('Section', 'Cell'),

And then try to put your chart in a cell that is 4500 wide:

$phpWord->addSection()->addTable()->addRow()->addCell(4500)->addChart($type,[],[]);

If this works, maybe you can send a patch in?

Was this page helpful?
0 / 5 - 0 ratings