1

网格线没有出现。下面是我的代码。请帮忙。

 <?php
 require_once '../Classes/PHPExcel.php';
 $inputFileName = 'current.xlsx'; 
 $inputFileType = PHPExcel_IOFactory::identify($inputFileName); 
 $objReader = PHPExcel_IOFactory::createReader($inputFileType);
 $objPHPExcel = $objReader->load($inputFileName);
 $objWorksheet = $objPHPExcel->getActiveSheet();
 $objPHPExcel->getActiveSheet()->setShowGridlines(true);

 $highestRow = $objWorksheet->getHighestRow(); 
 $highestColumn = $objWorksheet->getHighestColumn(); 
 $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); 

 echo '<div id="xl">' . "\n";
 echo '<table>' . "\n";
 for ($row = 1; $row <= 2; ++$row) {
 echo '<tr>' . "\n";

 for ($col = 0; $col <= $highestColumnIndex; ++$col) {
 echo '<td>' . $objWorksheet->getCellByColumnAndRow($col, $row)->getValue() . '</td>' .      "\n";
  }

 echo '</tr>' . "\n";
 }
 echo '</table>' . "\n";
echo '</div>' . "\n";
?>
4

1 回答 1

0

我把它显示为这样。下面是我的代码。

$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save('php://output');
于 2013-11-03T04:35:42.393 回答