将后台数据读取到前台的EXCEL文件中去,用javascript实现,asp.net,javacript(发一个原创)
2007-05-18 22:04
1226 查看
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<%
Response.Write("请加入信任站点");
%>
<script language="javascript" type="text/javascript">
var xlApp,xlBook,xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlBook = xlApp.Workbooks.Add();
xlBook.Worksheets.Add();
xlBook.Worksheets.Add();
var quArray = new Array(" ","1","2","3","4","5");
var i;
for( i=1;i<quArray.length;i++)
{
xlSheet = xlBook.Worksheets(i);
xlSheet.Name = quArray[i];
}
<%
for(int j=1;j<=5;j++)
{
%>
xlSheet = xlBook.Worksheets(quArray[<%=j%>]);
i=1;
xlSheet.Cells(i++,1).Value = "小名";
xlSheet.Cells(1,2).Value = "d";
xlSheet.Cells(1,3).Value = "a";
xlSheet.Cells(1,4).Value = "c";
var con = i-1;
xlSheet.Rows("1:"+con).Font.Size = 9;
xlSheet.Rows("1:"+con).RowHeight = 15;
xlSheet.Range("A1:D1").Interior.ColorIndex = 15;
xlSheet.Range("A1:D1").Interior.Pattern = 1;
xlSheet.Range("A1:D1").Font.ColorIndex = 1;
xlSheet.Range("A1:D1").HorizontalAlignment = 3;
xlSheet.Range("A1:D"+con).Borders.Weight = 2;
xlSheet.Range("A1:D"+con).Borders.ColorIndex = 1;
xlSheet.Columns("A:D").EntireColumn.AutoFit;
<%
}
%>
xlApp.Visible = true;
idTmr = window.setInterval("Cleanup();",1);
function Cleanup() {
window.clearInterval(idTmr);
CollectGarbage();
}
window.opener=null;
window.close();
</script>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<%
Response.Write("请加入信任站点");
%>
<script language="javascript" type="text/javascript">
var xlApp,xlBook,xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlBook = xlApp.Workbooks.Add();
xlBook.Worksheets.Add();
xlBook.Worksheets.Add();
var quArray = new Array(" ","1","2","3","4","5");
var i;
for( i=1;i<quArray.length;i++)
{
xlSheet = xlBook.Worksheets(i);
xlSheet.Name = quArray[i];
}
<%
for(int j=1;j<=5;j++)
{
%>
xlSheet = xlBook.Worksheets(quArray[<%=j%>]);
i=1;
xlSheet.Cells(i++,1).Value = "小名";
xlSheet.Cells(1,2).Value = "d";
xlSheet.Cells(1,3).Value = "a";
xlSheet.Cells(1,4).Value = "c";
var con = i-1;
xlSheet.Rows("1:"+con).Font.Size = 9;
xlSheet.Rows("1:"+con).RowHeight = 15;
xlSheet.Range("A1:D1").Interior.ColorIndex = 15;
xlSheet.Range("A1:D1").Interior.Pattern = 1;
xlSheet.Range("A1:D1").Font.ColorIndex = 1;
xlSheet.Range("A1:D1").HorizontalAlignment = 3;
xlSheet.Range("A1:D"+con).Borders.Weight = 2;
xlSheet.Range("A1:D"+con).Borders.ColorIndex = 1;
xlSheet.Columns("A:D").EntireColumn.AutoFit;
<%
}
%>
xlApp.Visible = true;
idTmr = window.setInterval("Cleanup();",1);
function Cleanup() {
window.clearInterval(idTmr);
CollectGarbage();
}
window.opener=null;
window.close();
</script>
</form>
</body>
</html>
相关文章推荐
- 将后台数据读取到前台的EXCEL文件中去,用javascript实现.(发一个原创)
- 利用ajax实现前台javascript同c#后台MVC下的aspx.cs文件传递数据的两种方法
- asp.net 读取并显示excel数据的实现代码
- asp.net实现从Txt文件读取数据到数据视图的方法
- asp.net中打开Excel上传文件,读取数据的方法
- ASP.NET中上传并读取Excel文件数据
- 一个将数据文件转换成excel文件打印的java实现方法的代码片断(Struts+poi)
- sql server 关于表中只增标识问题 C# 实现自动化打开和关闭可执行文件(或 关闭停止与系统交互的可执行文件) ajaxfileupload插件上传图片功能,用MVC和aspx做后台各写了一个案例 将小写阿拉伯数字转换成大写的汉字, C# WinForm 中英文实现, 国际化实现的简单方法 ASP.NET Core 2 学习笔记(六)ASP.NET Core 2 学习笔记(三)
- 关于“Asp.net 中后台CS读取数据库数据生成数组传递给前台页面JS使用”
- 【原创】Ext 上传文件,前后台实现, Asp.net 代码
- ASP.NET中上传并读取Excel文件数据,附后生成EXCEL及杀掉EXCEL进程
- 今天在ASP.NET上在写一个读取EXCEL文件内容的功能,但是IE8貌似把文件路径给屏蔽了,在IE6下面读取正常!有啥好办法?
- 前台extjs后台 java poi 读取excel数据到数据库中
- ASP.NET中使用JSON方便实现前台与后台的数据交换
- ASP.NET中上传并读取Excel文件数据示例
- asp.net 生成导出word表单 ,导出excel; dataTable生成xls文件,返回前台下载;asp.net启动excel错误 80070005;excel-xls columnName 不能改变; 读写excel的开源利器NPOI; 设置excel Cell的数据类型;
- 结合DataGrid控件ASP.NET上传并读取Excel文件数据
- ASP.NET中上传并读取Excel文件数据,附后生成EXCEL及杀掉EXCEL进程。
- ASP.NET中上传并读取Excel文件数据
- asp.net实现从Txt文件读取数据到数据视图的方法