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

Cant get color in rgb #2508

Closed
flaunder007 opened this issue Nov 24, 2023 · 0 comments · Fixed by #2512
Closed

Cant get color in rgb #2508

flaunder007 opened this issue Nov 24, 2023 · 0 comments · Fixed by #2512
Milestone

Comments

@flaunder007
Copy link

Describe the Bug

If importing from HTML, colors in rgb parsed wrong. Unlike colors in hex, by the way. But frontend build with react, and it transfer hex color in to rgb automaticaly, so i can't write colors in rgb.

Steps to Reproduce

<?php
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(array( 'pageNumberingStart' => 1 ));
$table = "<table>
<tbody>
<tr>
<td style='color: style=\"color: #A7D9C1ff;\"'>Thisone is purple</td>
<td style='color: style=\"color: rgb(167, 217, 193);\"'>Thisone is not</td>
</tr>
<tbody>
</table>
"

\PhpOffice\PhpWord\Shared\Html::addHtml($section, $htm,l, false, false);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');

Expected Behavior

It would be great if the colors in rgb were handled correctly too.

  • PHP Version: 8.1
  • PHPWord Version: 1.1.0
oleibman added a commit to oleibman/PHPWord that referenced this issue Nov 29, 2023
Fix PHPOffice#2508. Program currently expects `#xxxxxx` to specify a color when used by the `bgcolor` html attribute or the `color` or `background-color` css attributes. This PR allows support for `rgb(red, green, blue)` as well.
@Progi1984 Progi1984 added this to the 2.0.0 milestone Dec 25, 2023
Progi1984 pushed a commit that referenced this issue Jan 7, 2024
* Allow `rgb()` When Converting Html

Fix #2508. Program currently expects `#xxxxxx` to specify a color when used by the `bgcolor` html attribute or the `color` or `background-color` css attributes. This PR allows support for `rgb(red, green, blue)` as well.

* Update Change Log 2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants