Skip to content

Spaces are removed when alignment "end" #2773

Open
@vatsake

Description

@vatsake

Describe the bug and add attachments

When paragraph has alignment end, and the text has spaces at the end, the spaces are removed?

Expected behavior

The spaces are not removed.

Steps to reproduce

$phpWord = new PhpWord();
$phpWord->getSettings()->setHideGrammaticalErrors(true);
$phpWord->getSettings()->setHideSpellingErrors(true);
$phpWord->setDefaultFontSize(12);
$phpWord->setDefaultParagraphStyle([
    'lineHeight' => '1.5',
    'alignment' => Jc::START,
    'spaceAfter' => 0
]);
$phpWord->setDefaultFontName('Times New Roman');

$section = $phpWord->addSection(['marginLeft' => $helper->cmToTwip(3.17), 'marginRight' => $helper->cmToTwip(2), 'marginBottom' => $helper->cmToTwip(2.54), 'marginTop' => $helper->cmToTwip(2.54), 'headerHeight' => $helper->cmToTwip(3), 'footerHeight' => $helper->cmToTwip(2.5)]);

$section->addText('(name)                          ', ['size' => 10], ['alignment' => Jc::END]);
$phpWord->save("");

PHPWord version(s) where the bug happened

1.3.0

PHP version(s) where the bug happened

8.2

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions