public function actionExportpropertyexcel()
{
$Property = YOUR_SQL_QUERY
$filename = 'HEMANT - '.date('Y-m-d h:i:s').' - List.xls';
//header("Content-type: application/vnd-ms-excel");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".$filename);
echo '<table width="100%" border="1">
<thead>
<tr>
<th>Property id</th>
<th>Property Type</th>
<th>Property Name</th>
<th>Address</th>
<th>Pincode</th>
<th>City</th>
<th>State</th>
<th>Country</th>
<th>Added By</th>
<th>Status</th>
<th>Created On</th>
</tr>
</thead>';
foreach($Property as $prop)
{
echo '
<tr>
<td>'.$prop->id.'</td>
<td>'.$prop->property_type.'</td>
<td>'.$prop->detail->property_name.'</td>
<td>'.$prop->locality.'</td>
<td>'.$prop->pincode.'</td>
<td>'.$prop->city.'</td>
<td>'.$prop->state.'</td>
<td>'.$prop->country.'</td>
<td>'.$prop->property_owner_detail->detail->name.'</td>
<td>'.$prop->status.'</td>
<td>'.$prop->created_at.'</td>
</tr>
';
}
echo '</table>';
}
{
$Property = YOUR_SQL_QUERY
$filename = 'HEMANT - '.date('Y-m-d h:i:s').' - List.xls';
//header("Content-type: application/vnd-ms-excel");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".$filename);
echo '<table width="100%" border="1">
<thead>
<tr>
<th>Property id</th>
<th>Property Type</th>
<th>Property Name</th>
<th>Address</th>
<th>Pincode</th>
<th>City</th>
<th>State</th>
<th>Country</th>
<th>Added By</th>
<th>Status</th>
<th>Created On</th>
</tr>
</thead>';
foreach($Property as $prop)
{
echo '
<tr>
<td>'.$prop->id.'</td>
<td>'.$prop->property_type.'</td>
<td>'.$prop->detail->property_name.'</td>
<td>'.$prop->locality.'</td>
<td>'.$prop->pincode.'</td>
<td>'.$prop->city.'</td>
<td>'.$prop->state.'</td>
<td>'.$prop->country.'</td>
<td>'.$prop->property_owner_detail->detail->name.'</td>
<td>'.$prop->status.'</td>
<td>'.$prop->created_at.'</td>
</tr>
';
}
echo '</table>';
}
Hey Very nice Blog,Thanks For Sharing..
ReplyDeletePython training in Lucknow
Softpro Learning Center
best Php training center
Join Facebook Group and get Latest Post
ReplyDeletehttps://www.facebook.com/groups/allitdevelopers/