javascript从excel中读取数据_自己规定行数列数
来源:互联网 发布:网络胜利组漫画178 编辑:程序博客网 时间:2024/06/03 17:11
我以前写的,转过来。
<Html>
<HEAD>
<TITLE>javascript从excel中读取数据_自己规定行数列数_容错校验</TITLE>
<SCRIPT LANGUAGE = JavaScript>...
/**//*
常用的语句:
alert(opf.value); //id为opf的元件的值
document.write(""); //在网页中显示代码或文本
exWSheet.Cells(rows, cols).Value //excel文件每个格子里的值
try{ } catch(e){ } finally{ } //容错语句
*/
function addfile()...{
var exApp = new ActiveXObject("Excel.Application");
var exWBook = exApp.workbooks.open(opf.value);
var exWSheet = exWBook.Worksheets(1);
var i=1,j=1;
var col = parseInt(colnum.value,10),row = parseInt(rownum.value,10); //由于输入的内容不能够直接作为整形数据使用,因此要强行转换
//alert("行数:" + row);
//alert("列数:" + col);
if (isNaN(row) == true)...{ //isNaN是校验强制转换以后的数据是否为整形数据
alert("行号只能为数字");
return 0;
}
if (isNaN(col) == true)...{
alert("列号只能为数字");
return 0;
}
try...{
document.write("<table width=200%>");
while (i<=row) ...{
document.write("<tr>");
while (j<=col) ...{
document.write("<td>");
if (exWSheet.Cells(i, j).Value != null )...{
document.write(exWSheet.Cells(i, j).Value);
}
else...{
document.write("");
}
document.write("</td>");
j = j + 1;
}
i = i + 1;
j = 1;
nullmark = 0;
document.write("</tr>");
}
document.write("</table>");
}
catch(e)...{
alert("错误代号是:" + e);
}
finally ...{
exWBook.Close (savechanges=true);
exApp.Quit();
exApp = null;
//释放excel进程,关闭当前浏览器后有效。
}
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white">
<input type="file" id="opf" name="opfile"/><br />
行数:<input type="text" id="rownum"><br />
列数:<input type="text" id="colnum"><br />
<input type="submit" onclick="addfile()">
</BODY>
</HTML>
<HEAD>
<TITLE>javascript从excel中读取数据_自己规定行数列数_容错校验</TITLE>
<SCRIPT LANGUAGE = JavaScript>...
/**//*
常用的语句:
alert(opf.value); //id为opf的元件的值
document.write(""); //在网页中显示代码或文本
exWSheet.Cells(rows, cols).Value //excel文件每个格子里的值
try{ } catch(e){ } finally{ } //容错语句
*/
function addfile()...{
var exApp = new ActiveXObject("Excel.Application");
var exWBook = exApp.workbooks.open(opf.value);
var exWSheet = exWBook.Worksheets(1);
var i=1,j=1;
var col = parseInt(colnum.value,10),row = parseInt(rownum.value,10); //由于输入的内容不能够直接作为整形数据使用,因此要强行转换
//alert("行数:" + row);
//alert("列数:" + col);
if (isNaN(row) == true)...{ //isNaN是校验强制转换以后的数据是否为整形数据
alert("行号只能为数字");
return 0;
}
if (isNaN(col) == true)...{
alert("列号只能为数字");
return 0;
}
try...{
document.write("<table width=200%>");
while (i<=row) ...{
document.write("<tr>");
while (j<=col) ...{
document.write("<td>");
if (exWSheet.Cells(i, j).Value != null )...{
document.write(exWSheet.Cells(i, j).Value);
}
else...{
document.write("");
}
document.write("</td>");
j = j + 1;
}
i = i + 1;
j = 1;
nullmark = 0;
document.write("</tr>");
}
document.write("</table>");
}
catch(e)...{
alert("错误代号是:" + e);
}
finally ...{
exWBook.Close (savechanges=true);
exApp.Quit();
exApp = null;
//释放excel进程,关闭当前浏览器后有效。
}
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white">
<input type="file" id="opf" name="opfile"/><br />
行数:<input type="text" id="rownum"><br />
列数:<input type="text" id="colnum"><br />
<input type="submit" onclick="addfile()">
</BODY>
</HTML>
- javascript从excel中读取数据_自己规定行数列数
- javascript从excel中读取数据并显示
- 从excel中读取数据
- Excel获取行数和列数
- C#读取excel的有效行数或者最大有效列数
- javascript获取表格行数和列数
- 从数据库中读取数据到Excel
- Java从Excel中读取数据
- Matlab从Excel中读取数据
- Unity3D -- 从excel文件中读取数据
- 怎么从excel中读取数据_python
- excel 删除重复行数据,列数据
- EXCEL之读取列数据
- DataSet 取值,DataSet行数,DataSet列数 从DataSet中取出特定值
- DataSet 取值,DataSet行数,DataSet列数 从DataSet中取出特定值
- 【转】 从DataSet中取出特定值 DataSet 取值,DataSet行数,DataSet列数
- DataSet 取值,DataSet行数,DataSet列数 从DataSet中取出特定值
- DataSet 取值,DataSet行数,DataSet列数 从DataSet中取出特定值
- 如何产生一个随机数
- 发布自制的操作下拉列表框(SELECT)的三个jquery插件(ajax填充、联动、增加选项)
- CYG_ISR_CALL_DSR vs CYG_ISR_HANDLED
- QQ密码破解
- 怎样在ArcIMS 上实现专题图
- javascript从excel中读取数据_自己规定行数列数
- 基于Spring的DAO层设计
- 怎样在ArcIMS的应用开发中实现圆形区域选择?
- Allegro学习笔记五
- 学习心得
- ArcIMS Custom.js定制函数的模版
- javascript从excel中读取数据并显示
- WinSock网络编程学习笔记
- HTMLViewer鸟瞰图用框架实现