5
I need to convert an HTML table and generate the file in excel. How to set column width in excel? I create the HTML file using PHP and export using :
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: application/x-msexcel");
header ("Content-Disposition: attachment; filename=\"{$arquivo}\"" );
header ("Content-Description: PHP Generated Data" );
The point is that I cannot define the column width formatting in excel. In CSS the tab is correct but how to format column widths in excel?
I think there is no way, just generating a native XLS file. Already tried to export pure HTML or CSV to see what scrolls?
– Rodrigo Rigotti
yes, even then it loses formatting.
– Israel Zebulon
In fact you are not exporting to Excel, you are only forcing the browser to suggest that the file be opened by Excel. Maybe you need to generate a real Excel file, using HTML there are several formatting limitations (but I’m not sure that this is one of them).
– bfavaretto
knows some api type Worksheet.php to do this?
– Israel Zebulon