Skip to content

Add feature to get text & background color from inline CSS : td&th#180

Closed
kifni41 wants to merge 4 commits intoPHPOffice:developfrom
jagalab:feature/read_html_inline_css
Closed

Add feature to get text & background color from inline CSS : td&th#180
kifni41 wants to merge 4 commits intoPHPOffice:developfrom
jagalab:feature/read_html_inline_css

Conversation

@kifni41
Copy link
Contributor

@kifni41 kifni41 commented Jun 20, 2017

This is:

  • a bugfix
  • a new feature

Checklist:

What does it change?

Updated Pull Request from #178 , forgot to create new branch

I'm not sure if others need this feature, but this feature is quite handy for me and my team to directly generate excel file from html text, usually our client want specific coloring for the excel file and usually we already have the html for that.

This is limited for inline css inside and tag.

kifni41 added 2 commits June 16, 2017 14:36
Add feature to get text & background color from inline css, for td & th
@PowerKiKi
Copy link
Member

I think it would be best to extract your new code into a private method. Also docs/references/features-cross-reference.md should be updated accordingly.

@kifni41
Copy link
Contributor Author

kifni41 commented Jun 20, 2017

@PowerKiKi that's good idea, i'll update later..

update features-cross-reference
add samples
$supported_styles = ['background-color', 'color'];

// add color styles (background & text) from dom element,currently support : td & th, using ONLY inline css style with RGB color
if (isset($attributeArray['style'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can return early here to avoid too many nested blocks:

if (!isset($attributeArray['style'])) {
    return;
}

@PowerKiKi PowerKiKi closed this in 2a6ab17 Jun 23, 2017
@PowerKiKi
Copy link
Member

Thanks for the contribution

@kifni41
Copy link
Contributor Author

kifni41 commented Jun 23, 2017

you're welcome, i hope it'll be useful for others and i can contribute more in the future...

@kifni41 kifni41 deleted the feature/read_html_inline_css branch October 22, 2018 01:52
BlackyTay pushed a commit to BlackyTay/PhpSpreadsheet that referenced this pull request Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants