how can set style table while export php file excel
using following code can export php file excel
header("content-disposition: attachment; filename=".$fname."application.xls"); print "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\"> <style> @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} tr {mso-height-source:auto;} col {mso-width-source:auto;} br {mso-data-placement:same-cell; } .style0 {mso-number-format:general; text-align:general; vertical-align:bottom; white-space:nowrap; mso-rotate:0; mso-background-source:auto; mso-pattern:auto; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:arial; mso-generic-font-family:auto; mso-font-charset:0; border:none; mso-protection:locked visible; mso-style-name:normal; mso-style-id:0;} td {mso-style-parent:style0; padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:arial; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:general; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} .grids {mso-style-parent:style0; border:.5pt solid windowtext;}.head{ font-weight:bold; } </style> <head> <!--[if gte mso 9]><xml> <x:excelworkbook> <x:excelworksheets> <x:excelworksheet> <x:name>application list</x:name> <x:worksheetoptions> <x:print> </x:print> </x:worksheetoptions> </x:excelworksheet> </x:excelworksheets> </x:excelworkbook> </xml> <![endif]--> </head> <body>"; print '<table width="100%" border="0" cellspacing="1" cellpadding="2" class="tbl_content">'; print ' <tr class="head" valign="bottom"> <td align="center" width="7%" height="22"><b>sl no</b></td> <td align="left" width="18%"><b>name of party</b></td> <td align="left" width="18%"><b>godown</b></td> <td align="center" width="16%" ><b>invoice no</b></td> <td align="center" width="12%"><b>date</b></td> <td align="right" width="17%"><b>taxable turnover</b></td> <td align="right" width="14%"><b>vat amount</b></td> <td align="right" width="8%"><b>cess amt.</b></td> <td align="right" width="16%"><b>total turnover</b></td> </tr>'; print '</table></body></html>';
but style not taken when display in browser.
check out lib: php_writeexcel
Comments
Post a Comment