:::

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");
    

     


:::

書籍目錄

展開 | 闔起

http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D36%26tbdsn%3D1338

計數器

今天: 1280128012801280
昨天: 2138213821382138
總計: 7322562732256273225627322562732256273225627322562