Skip to content

Footnote should be allowed within ListItemRun #1287

@rootpd

Description

@rootpd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions