【问题标题】:Download Excel File containing Multiple Sheets下载包含多个工作表的 Excel 文件
【发布时间】:2010-11-15 18:35:13
【问题描述】:

我想使用 PHP 下载一个包含三张工作表的 excel 文件。谁能帮我?

【问题讨论】:

    标签: php excel


    【解决方案1】:

    如果我理解正确,您需要从 PHP 生成 Excel 文件

    如果是这样,请查看名为 Spreadsheet_Excel_Writer 的 PEAR 组件

    introduction of the manual 中,有一个示例看起来有点像您想要实现的目标:

    <?php
    require_once 'Spreadsheet/Excel/Writer.php';
    
    // Creating a workbook
    $workbook = new Spreadsheet_Excel_Writer();
    
    // sending HTTP headers
    $workbook->send('test.xls');
    
    // Creating a worksheet
    $worksheet =& $workbook->addWorksheet('My first worksheet');
    
    // The actual data
    $worksheet->write(0, 0, 'Name');
    $worksheet->write(0, 1, 'Age');
    $worksheet->write(1, 0, 'John Smith');
    $worksheet->write(1, 1, 30);
    $worksheet->write(2, 0, 'Johann Schmidt');
    $worksheet->write(2, 1, 31);
    $worksheet->write(3, 0, 'Juan Herrera');
    $worksheet->write(3, 1, 32);
    
    // Let's send the file
    $workbook->close();
    ?> 
    

    它可能会帮助你做你想做的事:-)


    如果我不明白,你只需要阅读一个 excel 文件......好吧:

    • 下载,可以使用curl,或者fopen之类的
    • 阅读它,PHP-ExcelReader 可能会成功

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 2020-12-22
      • 2020-07-17
      • 2020-10-15
      • 2015-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多