html - How can I set name to excel sheet in PHP? -


am generating .xls file <table> tags. export working fine. have set name sheet.

code follows:

<h2>==>> export table excel file <<==</h2> <?php      echo $excel_data = '<table border="1">         <thead>             <th width="1"></th>             <th align="left">s.no.</th>             <th align="left">name</th>             <th align="left">doj</th>         </thead>         <tbody>             <tr>                 <td width="1"></td>                 <td align="left">1</td>                 <td align="left">sreekanth kuriyala</td>                 <td align="left">04-06-2015</td>             </tr>             <tr>                 <td width="1"></td>                 <td align="left">2</td>                 <td>sk1</td>                 <td align="left">26-07-2015</td>             </tr>             <tr>                 <td width="1"></td>                 <td align="left">3</td>                 <td>&nbsp;&nbsp;&nbsp;&nbsp;sk2</td>                 <td align="left">26-07-2015</td>             </tr>         </tbody>     </table>';     $excel_file = 'report.xls';     file_put_contents ($excel_file, $excel_data); ?> </br> </br> <a href="<?php echo $excel_file; ?>" download>export excel</a> 

can me on this. in advance.

for have follow/generate excel file content structure instead of table structure.

you can use php library excel file generator. there many php library available can googling it. of are

  • phpexcel
  • simpleexcel php
  • pear excel writer
  • excel writer(xml) php

thanks.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -