:::

2-3 匯出 OpenDocument 的 ods 格式

  1. 使用ods物件庫,並指定不同mime type以及副檔名即可,其餘不變:
    <?php
    
    require 'vendor/autoload.php';
    
    use PhpOffice\PhpSpreadsheet\Spreadsheet;
    use PhpOffice\PhpSpreadsheet\Writer\Ods;
    
    $spreadsheet = new Spreadsheet();
    $sheet       = $spreadsheet->getActiveSheet();
    $sheet->setCellValue('A1', '這是第一格');
    
    $writer = new Ods($spreadsheet);
    header('Content-Type: application/vnd.oasis.opendocument.spreadsheet');
    header('Content-Disposition: attachment; filename="file.ods"');
    
    $writer->save("php://output");
    

     


:::

書籍目錄

展開 | 闔起

https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1338%26tbsn%3D36

計數器

今天: 617617617
昨天: 2027202720272027
總計: 7971658797165879716587971658797165879716587971658