1

I have a problem with PHPWord that I belive is version 0.11.0, I use the PHPWord for CI.

The issues is I cannot find the right php script to make the underline, this is the latest script I got,

$section->addText(
    $text, 
    [ 'underline' => \PhpOffice\PhpWord\Style\AbstractStyle::UNDERLINE_SINGLE ], // Problem with this line
    [ 'align' => \PhpOffice\PhpWord\Style\Alignment::ALIGN_CENTER ] // This one fine
);

But whenever the script I got, it always display an error or didnt give me what I want, (the underlined text).

This the error I got

An uncaught Exception was encountered

Type: Error

Message: Undefined class constant 'UNDERLINE_SINGLE'

Filename: C:\xampp\htdocs\test\application\controllers\Print.php

Line Number: 47

Backtrace:

File: C:\xampp\htdocs\test\index.php Line: 315 Function: require_once

I appreciate any help, thanks in advance.

1 Answers1

6

To implement a single underline, add an element: array('underline' => 'single') in your styling array

mahbad
  • 149
  • 1
  • 2
  • 19