如何把页面中table内的数据保存为EXCEL文件?

iamsatyr 2004-08-02 02:13:58
菜鸟提问:点一下确定,如何把页面中table内的数据保存为EXCEL文件?
...全文
93 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
RobinInBlue 2004-08-06
怎么我运行后总报var oXL = new ActiveXObject("Excel.Application"); 有错呢?
我猜是ActiveXObject这有问题,有谁知道怎么解决吗?
回复
iamsatyr 2004-08-02
看不懂,怎么是重复的呢?!
回复
wukuns007 2004-08-02
<SCRIPT LANGUAGE="JavaScript">
<!--
function AutomateExcel()
{
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.data;
var hang = table.rows.length;

var lie = table.rows(0).cells.length;

// Add table headers going cell by cell.
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;
}

}
oXL.Visible = true;
oXL.UserControl = true;
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function AutomateExcel()
{
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.data;
var hang = table.rows.length;

var lie = table.rows(0).cells.length;

// Add table headers going cell by cell.
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;
}

}
oXL.Visible = true;
oXL.UserControl = true;
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function AutomateExcel()
{
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.data;
var hang = table.rows.length;

var lie = table.rows(0).cells.length;

// Add table headers going cell by cell.
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;
}

}
oXL.Visible = true;
oXL.UserControl = true;
}
//-->
</SCRIPT>
<input type="button" name="out_word1" onclick="javascript:AutomateExcel() " value="Export to Excel" class="notPrint"> </td>
回复
kkgolf 2004-08-02
偶也想知道~~

UP一下!
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-02 02:13
社区公告
暂无公告