PHPexcel如何将单元格值显示到包含图像的网页中

时间:2017-07-29 05:37:14

标签: php phpexcel

我能够使用以下代码显示excel文件(.xls)中的值,我通过执行print_r来设法获取值,现在我的下一步是显示HTML表格中的每一行,这个文件还包含位于最后一列的图像,但我看不到任何可以转换成图像的文本,任何建议都会很棒!提前致谢!

<?php

//  Include PHPExcel_IOFactory
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';

$inputFileName = 'userimage.xls';

//  Read your Excel workbook
try {
    $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objPHPExcel = $objReader->load($inputFileName);
} catch(Exception $e) {
    die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}

//  Get worksheet dimensions
$sheet = $objPHPExcel->getSheet(0); 
$highestRow = $sheet->getHighestRow(); 
$highestColumn = $sheet->getHighestColumn();

//  Loop through each row of the worksheet in turn
for ($row = 1; $row <= $highestRow; $row++){ 
    //  Read a row of data into an array
    $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row,
                                    NULL,
                                    TRUE,
                                    FALSE);


        print_r($rowData);


}

我的输出

enter image description here

0 个答案:

没有答案