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

span is an inline element, but exporting word wraps #2511

Open
william-fanlei opened this issue Nov 28, 2023 · 2 comments
Open

span is an inline element, but exporting word wraps #2511

william-fanlei opened this issue Nov 28, 2023 · 2 comments
Milestone

Comments

@william-fanlei
Copy link

Describe the Bug

span is an inline element, but exporting word wraps

Steps to Reproduce

Please provide a code sample that reproduces the issue.

<?php
use PhpOffice\PhpWord\IOFactory;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\Html;

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

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

        $data = 'PHPWord is a library written in <span>pure PHP that provides</span> a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open Document Format for Office Applications (OpenDocument or ODF), and Rich Text Format (RTF)';
        Html::addHtml($section, $data, false, false);
        // 导出 Word 文档
        $objWriter = IOFactory::createWriter($phpWord);
        $objWriter->save($filePath);

### Expected Behavior

span tag don't wrap

### Current Behavior

span tag  wrap

### Context

Please fill in your environment information:

- PHP Version: 7.4
- PHPWord Version: 1.1
@william-fanlei
Copy link
Author

image

@oleibman
Copy link
Contributor

oleibman commented Dec 1, 2023

If you put <p> at the start of $data and </p> at the end, the span will be treated as inline.

@Progi1984 Progi1984 added this to the 2.0.0 milestone Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants