$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment;filename=$fileName");
header("Cache-Control: max-age=0");
$writer->save('php://output');
像那样导出时,所有行都将取消隐藏。我已经验证这些行实际上隐藏在原始文件中。 我该如何解决这个问题?
最佳答案
问题在于,您实际上是在制作一份副本,您必须在编写文档之前隐藏该行。要隐藏第 10 行,请使用:
$spreadsheet->getActiveSheet()->getRowDimension('10')->setVisible(false);
文档中提供了更多信息 here
关于PHP电子表格 |保存 XLSX 取消隐藏每一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63748160/