php ExcelReader 读取Excel类
程序员文章站
2022-05-15 08:10:09
...
这是一款开源的php代码,ExcelReader是专业地excel表进行读写操作的,下面我们来看一款ExcelReader读取phprm.com.xls工作表实例吧,代码如下:
";
$table_output[$sheet] = str_replace(" ", "", $table_output[$sheet]);
$table_output[$sheet] = str_replace(" ", "", $table_output[$sheet]);
$table_output[$sheet] = str_replace(" ", " ", $table_output[$sheet]);
if ($debug) {
$debug_output = print_r($data->sheets[$sheet], true);
$debug_output = str_replace(" ", "n", $debug_output);
$debug_output = str_replace(" ", "r", $debug_output);
$table_output[$sheet].= "
setoutputencoding('cpa25a'); $data->read($file_to_include); error_reporting(e_all ^ e_notice); echo " "; function make_alpha_from_numbers($number) { $numeric = "abcdefghijklmnopqrstuvwxyz"; if ($number var sheet_html = array(); "; for ($sheet = 0; $sheet sheets); $sheet++) { $table_output[$sheet].= "
"; for ($i = 0; $i sheets[$sheet]['numcols'] && ($i " . make_alpha_from_numbers($i) . ""; } for ($row = 1; $row sheets[$sheet]['numrows'] && ($row | " . $row . " | "; for ($col = 1; $col sheets[$sheet]['numcols'] && ($col sheets[$sheet]['cellsinfo'][$row][$col]['colspan'] >= 1 && $data->sheets[$sheet]['cellsinfo'][$row][$col]['rowspan'] >= 1) { $this_cell_colspan = " colspan=" . $data->sheets[$sheet]['cellsinfo'][$row][$col]['colspan']; $this_cell_rowspan = " rowspan=" . $data->sheets[$sheet]['cellsinfo'][$row][$col]['rowspan']; for ($i = 1; $i sheets[$sheet]['cellsinfo'][$row][$col]['colspan']; $i++) { $data->sheets[$sheet]['cellsinfo'][$row][$col + $i]['dontprint'] = 1; } for ($i = 1; $i sheets[$sheet]['cellsinfo'][$row][$col]['rowspan']; $i++) { for ($j = 0; $j sheets[$sheet]['cellsinfo'][$row][$col]['colspan']; $j++) { $data->sheets[$sheet]['cellsinfo'][$row + $i][$col + $j]['dontprint'] = 1; } } } else if ($data->sheets[$sheet]['cellsinfo'][$row][$col]['colspan'] >= 1) { $this_cell_colspan = " colspan=" . $data->sheets[$sheet]['cellsinfo'][$row][$col]['colspan']; $this_cell_rowspan = ""; for ($i = 1; $i sheets[$sheet]['cellsinfo'][$row][$col]['colspan']; $i++) { $data->sheets[$sheet]['cellsinfo'][$row][$col + $i]['dontprint'] = 1; } } else if ($data->sheets[$sheet]['cellsinfo'][$row][$col]['rowspan'] >= 1) { $this_cell_colspan = ""; $this_cell_rowspan = " rowspan=" . $data->sheets[$sheet]['cellsinfo'][$row][$col]['rowspan']; for ($i = 1; $i sheets[$sheet]['cellsinfo'][$row][$col]['rowspan']; $i++) { $data->sheets[$sheet]['cellsinfo'][$row + $i][$col]['dontprint'] = 1; } } else { $this_cell_colspan = ""; $this_cell_rowspan = ""; } if (!($data->sheets[$sheet]['cellsinfo'][$row][$col]['dontprint'])) { $table_output[$sheet].= " ";
if ($force_nobr) {
$table_output[$sheet].= " | ";
}
}
$table_output[$sheet].= "
$debug_output"; } echo "sheet_html[$sheet] = "$table_output[$sheet]"; "; } echo " function change_tabs(sheet) { //alert('sheet_tab_' + sheet); for(i=0;isheets) , ";i++) { document.getelementbyid('sheet_tab_' + i).classname = 'tab_base'; } document.getelementbyid('table_loader_div').innerhtml=sheet_html[sheet]; document.getelementbyid('sheet_tab_' + sheet).classname = 'tab_loaded'; } "; echo "
", $data->boundsheets[$sheet]['name'], " | "; } echo "
www.phprm.com
";
//echo "";
/*
echo ""; print_r($data); echo ""; */
excelreader这个类你可以到官网去下载 .
推荐阅读
-
PHP读取配置文件类实例(可读取ini,yaml,xml等)
-
php实现的操作excel类详解
-
php导出中文内容excel文件类实例
-
php读取excel文件示例分享(更新修改excel)
-
PHP读取Excel内的图片(phpspreadsheet和PHPExcel扩展库)
-
C#_Excel数据读取与写入_自定义解析封装类_支持设置标题行位置&使用excel表达式收集数据&单元格映射&标题映射&模板文件的参数数据替换(第二版-增加深度读取和更新功能)
-
[PHP] PHP调用IMAP协议读取邮件类库
-
PHP读取Excel内的图片
-
php读取EXCEL文件 php excelreader读取excel文件
-
php excel类 phpExcel使用方法介绍