phpspreadsheet:在单元格中放置/显示多个空间(空间/凹痕)
我正在使用\ phpoffice \ phpspreadsheet \ Reader \ html()读取HTML表以将其保存到XLSX电子表格中。我需要在某些行上进行缩进,例如应该这样看:
Cost of Sales
Stock
Courier Fees
在HTML表中,使用& amp; amp; amp; amp; amp; nbsp; nbsp; 很容易了进入Excel细胞的空间。我已经尝试了“  nbsp; nbsp;'' (多个空间)和< td style ='padding-Left:10px;'> ,甚至< td style ='Margin-Left:10px;'> 以防万一,一切都无济于事。我在Google上找不到任何东西可以提供帮助,并希望有任何建议。
以防万一,我将包括如何阅读/编写存储在$ Incomestatement中的HTML表:
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html();
$spreadsheet = $reader->loadFromString($incomeStatement);
// [headers]
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$spreadsheet->save('php://output');
I'm using \PhpOffice\PhpSpreadsheet\Reader\Html() to read an HTML table to save into an XLSX spreadsheet. I need indentation on some rows, for example it should appear like this:
Cost of Sales
Stock
Courier Fees
In the HTML table it's easy using , but this doesn't take those multiple spaces into the Excel cells. I've tried " " (multiple spaces) and <td style='padding-left:10px;'> and even <td style='margin-left:10px;'> just in case, all to no avail. I can't find anything on Google to assist and would appreciate any advice.
Just in case, I'll include how I'm reading/writing the HTML table stored in $incomeStatement:
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html();
$spreadsheet = $reader->loadFromString($incomeStatement);
// [headers]
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$spreadsheet->save('php://output');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用HTML TAG
span
之后的示例类似于该示例的示例之类的空间,将成为4个空格
use combination with html tag
span
followed by space like sample belowthis example will make 4 spaces