Please prefix your issue with one of the following: [BUG] [PROPOSAL] [QUESTION].
Package: 2.1
Laravel: 5.3
Export an xlsx file with a larger font size for one cell
Lose all styling
<table>
<tbody>
<tr>
<td colspan="5" style="text-align: center; font-size: 18px; background: #000000; color: #76933C; font-weight: bold;">Test</td>
</tr>
</tbody>
</table>
If I remove the font-size: 18px I get a file with the rest of the styling on that cell, if I add the font-size: 18px I get an error when opening the excel file that says:
"We found a problem with some content in 'example.xlsx'. Do you want us to try to recover as much as we can?"
Clicking yes opens it, but with no styling.
This is in Microsoft Office Plus 2016
I'm unable to reproduce this.
You can fix it by not giving it a unit like this
<table>
<tbody>
<tr>
<td colspan="5" style="text-align: center; font-size: 18; background: #000000; color: #76933C; font-weight: bold;">Test</td>
</tr>
</tbody>
</table>
reference: https://github.com/PHPOffice/PHPExcel/issues/1201
Same for, me. The problem is, that it is not working with px. Not only inline styles, but also external css file. Work around, which provided by mrclronald is working only for Excel file, but not for UI, also, if it would work, I don't want to use inline style in all places I need.
if I write in external css: td {width:200px} - columns became 0 px wide in excel file and 200px wide in ui. Otherwise if I use style like this: td { width:200 } - columns become very wide in excel and auto in UI
Additional if you use "px" in your style, excel file opens with recovery and error message:
Removed Part: /xl/styles.xml part with XML error. (Styles) Load error. Line 2, column 0.
Repaired Records: Cell information from /xl/worksheets/sheet1.xml part
PHP version: 7.1.13
Laravel version: 5.6.15
Package version: 2.1.27
Most helpful comment
You can fix it by not giving it a unit like this
reference: https://github.com/PHPOffice/PHPExcel/issues/1201