【问题标题】:Save File in PHPExcel在 PHPExcel 中保存文件
【发布时间】:2022-12-03 16:27:52
【问题描述】:

是否可以在不在 PHPExcel 中创建编写器对象的情况下保存现有文件?

$filename = 'test.xlsx';
$phpExcel = PHPExcel_IOFactory::load($filename);
$phpExcel->save($filename);

【问题讨论】:

    标签: phpexcel-1.8.0


    【解决方案1】:
    header('Content-Type: application/vnd.ms-excel');
            header('Content-Disposition: attachment;filename="filename.xls"');
            header('Cache-Control: max-age=0');
    
            $objWriter = PHPExcel_IOFactory::createWriter($excel_obj, 'Excel2007');
            $objWriter->save('php://output');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-25
      • 2015-02-27
      相关资源
      最近更新 更多