http://pear.php.net/package/Spreadsheet_Excel_Writer自己写脚本哦还有phpMyAdmin2.6.x也能直接导出数据到Excel的
很方便

解决方案 »

  1.   

    phpMyAdmin能导出MS Excel 的 CSV 格式
      

  2.   

    谢谢!phpMyAdmin确实可以。不过我想实现的是把符合条件的搜索结果导出来,而不是导出整个表。搜索的功能我已经实现了,就差导出的功能了。那个Spreadsheet Excel Writer不知道怎么用,能不能解释一下?
      

  3.   

    phpMyAdmin也可以按搜索条件导出,我看到了。可是到phpMyAdmin里面操作还是不太方便。
      

  4.   

    直接将程序产生的html表格写到后缀为xls的文件里就可以了
      

  5.   

    下载解压以后应该放到哪个目录?我放在网页目录下运行writer.php出错,我从来没有用过pear,不知道应该如何配置?
      

  6.   

    我写了一个类 
    class Cexcel
     {
      var $fileName;
        function Cexcel($file)
       {
         if($file!='')
        {
         $this->fileName=$file;
        }
       }
       function Downxls() {
       header("Content-type: application/vnd.ms-excel");
       header("Content-Length: ".filesize("./".$this->fileName.""));
       header("Content-Disposition: attachment; filename=./".$this->fileName."");
       if(file_exists("./".$this->fileName.""))
    readfile("./".$this->fileName."");
    exit(0);
       }
       function xlsBOF() {     
        return pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); 
       } 
       function xlsEOF() { 
        return pack("ss", 0x0A, 0x00); 
       } 
       function xlsWriteNumber($Row, $Col, $Value) { 
        $result=pack("sssss", 0x203, 14, $Row, $Col, 0x0); 
        $result.=pack("d", $Value); 
        return $result; 
        } 
       function xlsWriteLabel($Row, $Col, $Value ) { 
           $L = strlen($Value); 
            $result=pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); 
           $result.=$Value; 
           return $result; 
        }
     }
      

  7.   

    调用方法,就按下面顺序可以了了
    xlsBOF() 
    xlsWriteLabel
    xlsWriteNumber
    xlsBOF() 
    Downxls()