I have this code
<?php
header("Content-type: application/vnd.ms-excel; name='excel'");
header("Content-Disposition: filename=export.xls");
// Fix for crappy IE bug in download.
header("Pragma: ");
header("Cache-Control: ");
echo $_REQUEST['datatodisplay'];
?>
It puts the data from a html table into excel, but the only problem is that i don`t see the gridline in the sheet. Am i missing something? Thanks
Select the worksheet. Click the Page Layout tab. To show gridlines: Under Gridlines, select the View check box. To hide gridlines: Under Gridlines, clear the View check box.
Export Data from Database:$fileName – Define the name of the excel file to be downloaded. $fields – Define the column named of the excel sheet. $excelData – Add the first row to the excel sheet as a column name. Fetch member's data from the database and add to the row of the excel sheet.
Today i run into same issue as OP did.
I found @Jayant Pandey answer to be really close to my needs! But issue was that grid border was bigger that header border so instead of 1px
i used 0.1pt
Example:
<!DOCTYPE html>
<html>
<body style="border: 0.1pt solid #ccc">
<--! SOME EXCEL CONTENT HERE -->
</body>
</html>
I do know this is an old question but maybe someone is looking for this!
Make sure you DO NOT have a "background-color
" attribute defined for your HTML <BODY>
tag. That was my problem. Remove it and all the gridlines will magically re-appear in Excel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With