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

Get footnotes twice #2418

Open
Zoolootooy opened this issue Jul 3, 2023 · 1 comment
Open

Get footnotes twice #2418

Zoolootooy opened this issue Jul 3, 2023 · 1 comment

Comments

@Zoolootooy
Copy link

I'm trying to get footnotes from a document, but for some reason I'm getting it twice.

 $phpWord = IOFactory::load('./Test.docx');
 $content = '';
 $footnotes = $phpWord->getFootnotes()->getItems();
//Here I already have all footnotes twice
foreach ($footnotes as $footnote) {
    $string = '';
    foreach ($footnote->getElements() as $element) {
        if ($element instanceof \PhpOffice\PhpWord\Element\Text) {
            $string .= strlen($element->getText()) > 0 ?trim($element->getText()) . ' ' : '';
        }
//                $string .=  ' ';
    }
    $content .= $string . PHP_EOL;
}

Any ideas why this is happening?

@Progi1984
Copy link
Member

@Zoolootooy Could you a sample file ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants