Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footnote should be allowed within ListItemRun #1287

Closed
2 of 3 tasks
rootpd opened this issue Feb 16, 2018 · 1 comment
Closed
2 of 3 tasks

Footnote should be allowed within ListItemRun #1287

rootpd opened this issue Feb 16, 2018 · 1 comment

Comments

@rootpd
Copy link

rootpd commented Feb 16, 2018

This is:

Expected Behavior

Library should allow creating Footnote within ListItemRun.

Current Behavior

BadMethodCallException is being thrown from PhpOffice\PhpWord\Element\AbstractContainer

How to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$liRun = $section->addListItemRun(0, ['listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER]);
$liRun->addText('foo');
$fn = $liRun->addFootnote();
$fn->addText($footnote);

I've tried to comment the thrown exception. Generated word is valid and displaying correctly. This is solely to revise allowed containers for footnote container.

Thank you.

Context

  • PHP version: 7.1
  • PHPWord version: 0.14
@troosan
Copy link
Contributor

troosan commented Feb 17, 2018

all you need to change is the AbstractContainer

            'Footnote'      => array('Section', 'TextRun', 'Cell', 'ListItemRun'),

I'll create a PR for it.

@troosan troosan mentioned this issue Feb 17, 2018
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants