Échec de l'export vers le format .xlsx

J'ai essayé d'exporter ma table au format .xlsx. Mais il est impossible de le faire. Jusqu'à présent, j'ai fait ceci:

header('Content-type: application/octet-stream'); header('Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); //should be a correct mimetype header('Content-Disposition:attachment; filename="contoh-1.xlsx"'); 

Voici l'erreur: entrez la description de l'image ici

Voici comment je génère datatables. Manette:

 public function kategori_excel(){ $paramKategori = $this->input->get('CategoryCode'); $get_url_kategori = $this->ws_url->GetUrl('CategoryResortingeve?CategoryCode='.$paramKategori); $get_json_kategori = json_decode(file_get_contents($get_url_kategori), true); $data['itemKategoriToExcel'] = $get_json_kategori['Kategoris']; $this->load->view('kategori_excel', $data); } 

Et voici la vue:

 <table border='1' width="100%"> <tr> <th>Kode</th> <th>Nama</th> <th>Definisi</th> <th>Unsur Abstrak</th> <th>Alias</th> <th>Sumber Definisi</th> <th>Tanggal</th> <th>Tipe Tanggal</th> <th>Edisi</th> <th>Role</th> <th>Other Citation Detail</th> <th>Nama Katalog</th> <th>Nama Organisasi</th> </tr> <?php foreach($itemKategoriToExcel as $item): ?> <tr> <td><?php echo $item['KodeKategori'] ?></td> <td><?php echo $item['Nama'] ?></td> <td><?php echo $item['Definisi'] ?></td> <td><?php echo $item['UnsurAbstrak'] ?></td> <td><?php echo $item['Alias'] ?></td> <td><?php echo $item['SumberDefinisi'] ?></td> <td><?php echo $item['Tanggal'] ?></td> <td><?php echo $item['TipeTanggal'] ?></td> <td><?php echo $item['Edisi'] ?></td> <td><?php echo $item['Role'] ?></td> <td><?php echo $item['OtherCitationDetail'] ?></td> <td><?php echo $item['NamaKatalog'] ?></td> <td><?php echo $item['NamaOrganisasi'] ?></td> </tr> <?php endforeach; ?> </table> ?> <table border='1' width="100%"> <tr> <th>Kode</th> <th>Nama</th> <th>Definisi</th> <th>Unsur Abstrak</th> <th>Alias</th> <th>Sumber Definisi</th> <th>Tanggal</th> <th>Tipe Tanggal</th> <th>Edisi</th> <th>Role</th> <th>Other Citation Detail</th> <th>Nama Katalog</th> <th>Nama Organisasi</th> </tr> <?php foreach($itemKategoriToExcel as $item): ?> <tr> <td><?php echo $item['KodeKategori'] ?></td> <td><?php echo $item['Nama'] ?></td> <td><?php echo $item['Definisi'] ?></td> <td><?php echo $item['UnsurAbstrak'] ?></td> <td><?php echo $item['Alias'] ?></td> <td><?php echo $item['SumberDefinisi'] ?></td> <td><?php echo $item['Tanggal'] ?></td> <td><?php echo $item['TipeTanggal'] ?></td> <td><?php echo $item['Edisi'] ?></td> <td><?php echo $item['Role'] ?></td> <td><?php echo $item['OtherCitationDetail'] ?></td> <td><?php echo $item['NamaKatalog'] ?></td> <td><?php echo $item['NamaOrganisasi'] ?></td> </tr> <?php endforeach; ?> </table> 

Comment puis-je réparer cette ou ces choses?