代码在下边贴出来了,在从浏览器端下载的excel文件打不开,但是如果直接保存服务器上就可以打开,我的office是07不是版本问题,这是怎么回事,请高手指点。    require_once (Kohana::find_file('libraries/PHPExcel', 'IOFactory'));
    require_once (Kohana::find_file('libraries/PHPExcel', 'RichText'));    $output_excel_file = DOCROOT .$root['root'] . "votes".date('Y')."-".date('n') . ".xlsx";// Create new PHPExcel object
   $objPHPExcel = new PHPExcel();// Set properties
   $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
 ->setLastModifiedBy("Maarten Balliauw")
 ->setTitle("votes")
 ->setSubject("Office 2007 XLSX Test Document")
 ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
 ->setKeywords("office 2007 openxml php")
 ->setCategory("Test result file");// Add some data
   $objPHPExcel->setActiveSheetIndex(0)
            ->setCellValue('A1',$title)
            ->setCellValue('A2', 'name')
            ->setCellValue('B2', 'count')            
            ->setCellValue('A3', 'Hello')
            ->setCellValue('B3', 'world!')
            ->setCellValue('C1', 'Hello')
            ->setCellValue('D2', 'world!');
 
// Rename sheet
   $objPHPExcel->getActiveSheet()->setTitle('votes');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
   $objPHPExcel->setActiveSheetIndex(0);// Redirect output to a client’s web browser (Excel2007)
   header('Content-Type: application/vnd.ms-excel;charset=utf-8');
   header('Content-Disposition: attachment;filename=votes.xlsx');
   header('Cache-Control: max-age=0');
   $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//   $objWriter->save($output_excel_file);     //保存到服务器可以打开,数据完好
$objWriter->save('php://output');