Wednesday, April 27, 2016

Custom download to excel using php


 <?php
 $content="<table><tr><td style='color:red;background-color:green;'>created by bikash</td></tr></table>";

$downloadFileName = 'test_report_'.time().'.xls';
 $filename = SITE_PATH_SPDATA."xml_data/reports/$downloadFileName";
 header("Cache-Control: no-store, no-cache, must-revalidate");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");
 header("Content-Type: application/vnd.ms-excel");
 header("Content-Length: strlen($achDowloadContent)");
 header("Content-Disposition:; filename=$downloadFileName");
 echo $contents;

?>

3 comments:

  1. Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.

    salesforce training in chennai

    ReplyDelete
  2. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.

    Branding Services in Chennai

    ReplyDelete