:::

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

:::

書籍目錄

展開 | 闔起

快速登入


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

計數器

今天: 1860186018601860
昨天: 2602260226022602
總計: 8096188809618880961888096188809618880961888096188