insert an HTML code in a Cell using PhpSpreadsheet

Viewed 1469

Is there a way to insert an HTML code into a Cell using PhpSpreadsheet? For example this code :

<font color="red">Hello World!</font>

This HTML already giving the text a style without going through the pre-defined PhpSpreadsheet's style functions.

1 Answers

The solution already exist: You just need to add the following :

$CODE="<font color="red">Hello World!</font>";
$html = new PhpOffice\PhpSpreadsheet\Helper\Html();
$HTMLCODE = $html->toRichTextObject($CODE);
Related