PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.37k stars 3.47k forks source link

Image Transparency/Opacity Including Html Reader Changes #4142

Closed oleibman closed 1 month ago

oleibman commented 3 months ago

See discussion #4117. This PR implements image transparency, for Xlsx Reader and Writer, Html Reader, and Html/Dompdf/Mpdf Writer. (Mpdf treats 100% opacity as if it were zero, but it's otherwise okay and that would be an unusual choice anyhow.) A new property opacity with getter/setter is added to BaseDrawing (and therefore Drawing and MemoryDrawing). Although the Excel UI lets you set the image transparency, the value stored in the Xml is actually its opacity (expressed as an integer between 0 and 100,000). Likewise Html/Css lets you set opacity (as a float between 0 and 1). PhpSpreadsheet lets you set it as it is stored in Xml - so a value of 40,000 would indicate 40% opacity = 60% transparency.

In the course of testing, some problems with Html Reader presented themselves. They are corrected as part of this ticket:

This is:

Checklist:

Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate). If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.

oleibman commented 1 month ago

Too much has happened since this PR was started. I will probably replace it with a new version.

oleibman commented 1 month ago

Not sure why "docs" step failed, but, since this PR doesn't update any docs, I don't think there's any cause for concern.