:::

2-2 套用樣板

  1. 好處是不用全部都用程式來寫,可以自己設定好各種花俏的格式,程式只負責把值填上
    <?php
    
    require 'vendor/autoload.php';
    
    $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('test.xlsx');
    
    $worksheet = $spreadsheet->getActiveSheet();
    
    $worksheet->getCell('A1')->setValue('套用樣板測試');
    
    header('Content-Type: application/vnd.ms-excel');
    header('Content-Disposition: attachment;filename="套用樣板測試.xls"');
    header('Cache-Control: max-age=0');
    
    $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
    $writer->save('php://output');
    

     

  2. 簡單的樣板:text.xlsx

:::

書籍目錄

展開 | 闔起

快速登入


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

計數器

今天: 5049504950495049
昨天: 2489248924892489
總計: 8027031802703180270318027031802703180270318027031