Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在网页中显示excel文件数据,使其与phpexcel中的文件完全相同?_Php_Phpexcel - Fatal编程技术网

如何在网页中显示excel文件数据,使其与phpexcel中的文件完全相同?

如何在网页中显示excel文件数据,使其与phpexcel中的文件完全相同?,php,phpexcel,Php,Phpexcel,我在codeigniter应用程序中使用PHPExcel库。我有这个密码 $file = './assets/test.xlsx'; $objPHPExcel = PHPExcel_IOFactory::load($file); $cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection(); foreach ($cell_collection as $cell) { $column = $objP

我在codeigniter应用程序中使用PHPExcel库。我有这个密码

$file = './assets/test.xlsx';
$objPHPExcel = PHPExcel_IOFactory::load($file);
$cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
foreach ($cell_collection as $cell) {
    $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
    $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
    $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
    if ($row == 1) {
        $header[$row][$column] = $data_value;
    } else {
        $arr_data[$row][$column] = $data_value;
    }
}

它读取excel文件并将文件数据存储在数组中。但是,如何在页面中完全按照文件中的数据显示文件的数据呢。表将是动态的,所有数据的顺序应与文件中的顺序相同。

数组保持插入元素的顺序,您只需将内容与表/td混合输出即可。使用PHPExcel的HTML编写器生成标记,它甚至可以为您处理样式设置