:::

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%3Ftbdsn%3D1338%26tbsn%3D36

計數器

今天: 1870187018701870
昨天: 2602260226022602
總計: 8096198809619880961988096198809619880961988096198