Skip to content

addLink does not style with the submitted font style #2796

Open
@deligant

Description

@deligant

Describe the bug and add attachments

whatever font style type one sets in addLink, it always outputs the "arial bluish, underlined" font with no style. I also tried the sample provided with no change.
Going into debugging mode I saw that the element it self is correctly styled, so I recon it is in the output that it jams.

  • odt output

source code:
Image

result:

Image

Expected behavior

The first link should be red and double underline

Steps to reproduce

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

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
// Add hyperlink elements
$section->addLink(
    'https://github.com/PHPOffice/PHPWord',
    'PHPWord on GitHub',
    ['color' => 'FF0000', 'underline' => PhpOffice\PhpWord\Style\Font::UNDERLINE_DOUBLE]
);
$section->addTextBreak(2);
$section->addLink('http://www.bing.com', null, $linkFontStyleName);
$section->addLink('http://www.yahoo.com', null, $linkFontStyleName);


// Saving the document as ODF file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');

header('Content-type: application/vnd.oasis.opendocument.text');
header( 'Content-Disposition: attachment; filename="sample.odt"' );
$objWriter->save("php://output");

PHPWord version(s) where the bug happened

1.4

PHP version(s) where the bug happened

8.1.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