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

HTML Writer losing title text #1435

Closed
1 of 3 tasks
begnini opened this issue Jul 18, 2018 · 0 comments
Closed
1 of 3 tasks

HTML Writer losing title text #1435

begnini opened this issue Jul 18, 2018 · 0 comments

Comments

@begnini
Copy link
Contributor

begnini commented Jul 18, 2018

This is:

Expected Behavior

Html Writer should write the title text.

Current Behavior

When the text content of a Title is a TextRun, the writer is losing the text, returning a empty <h1>.

Failure Information

If a title contains a TextRun instead a string, the writer is losing the text and returning empty between the header tags.

How to Reproduce

Please provide a code sample that reproduces the issue.

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

$phpWord = new PhpWord();
$section = $phpWord->addSection();

$textRun = new TextRun();
$textRun->addText('TextRun with Title');
        
$title = $section->addTitle($textRun);

$htmlWriter = new HTML($phpWord);
$content = $htmlWriter->getContent();

# should be true, is returning false
echo (strpos($content, 'TextRun with Title') !== false);

Context

  • PHP version: 7.2.2
  • PHPWord version: 0.15
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

1 participant