php ExcelReader 读取Excel类
程序员文章站
2022-05-01 12:54:42
...
这是一款开源的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这个类你可以到官网去下载 .
推荐阅读
-
PHP5读取EXCEL内容时的一个正则表达式函数解决办法
-
php读取excel日期类型数据的例子_PHP教程
-
Php读取excel中时间表格时不对
-
php读取excel资料-reader.php excel操作类使用
-
关于php读取excel有关问题
-
Drupal读取Excel并导入数据库实例_php实例
-
PHP基于COM的Excel操作类(PHP5)
-
老话题了.PHP导出EXCEL,phpexcel类很强大,但是效率低速度慢,fputcsv速度快但不知道怎么解决科学计数法的问题,求老司机传授经验
-
php excel reader 读取时间字段出错,哪位高手会弄得
-
用php读取excel插入mysql