You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [X ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
No error
What is the current behavior?
An error for every with "width" property in percent
What are the steps to reproduce?
Generate Excel from HTML table with "width property" in tags in percent.
<?phprequire__DIR__ . '/vendor/autoload.php';
// $vcTable is an string with a simple table in HTML with any <td width="xx%">$vcTable='<table><tr><td width="15%">A</td><td>B</td><td>C</td></tr></table>';
$tmpfile = tempnam(sys_get_temp_dir(), 'html');
file_put_contents($tmpfile, $vcTable);
// Create new Spreadsheet object$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$reader = newPhpOffice\PhpSpreadsheet\Reader\Html();
// add code that show the issue here...$reader->loadIntoExisting($tmpfile, $spreadsheet);
Which versions of PhpSpreadsheet and PHP are affected?
Checked in last version (1.18.0)
The text was updated successfully, but these errors were encountered:
Better support for units for column width and row height when reading html is probably doable. However, it is particularly difficult to figure out what should be done when the measurement is specified as a percentage. Would it be acceptable to you if PhpSpreadsheet merely ignored the width indication if it is specified as a percentage? That would satisfy your "no error" expected behavior. If not, what do you think it should be doing when it sees a percentage rather than a fixed unit?
I have a half-written update to the column width management for the Html Reader, but it's pretty arbitrary with all the css "relative" UoMs - em, ex, ch and rem are all character-based, so it simply bases the width on the arbitrary default column width of 8.54 for 10 Calibri 11pt characters; % is the percentage of 8.54; and vw, vh, vmin and vmax all simply set the width to 8.54. "Absolute" units like pt, px, pc, cm, mm and in are more straightforward; based on 96dpi, and then adjusted to Microsoft's awkward values based on Calibri 11pt;
At this moment, for us, is enought if the library ignore the width configuration when is set in "%". When it write lots of messages, Excel sheet is not generated, and that is the real problem.
This is:
What is the expected behavior?
No error
What is the current behavior?
An error for every with "width" property in percent
What are the steps to reproduce?
Generate Excel from HTML table with "width property" in tags in percent.
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Which versions of PhpSpreadsheet and PHP are affected?
Checked in last version (1.18.0)
The text was updated successfully, but these errors were encountered: