<%
response.buffer = true
'告诉浏览器用word来显示文档内容
Response.ContentType = "application/vnd.ms-excel"
'文档设定
response.AddHeader "content-disposition", "inline; filename=report.xls"
%>
<html>
<head>
<title>报表</title>
</head>
<body bgcolor="#FFFFFF">
<center><h1>报表</h1></center>
<table border=1 cellspacing=0 cellpadding=0 bordercolor=#000000 align=center>
<tr>
<td>用户名</td>
<td>真实姓名</td>
<td>性别</td>
</tr>
=====================================
程序-HTML表格-EXCEL表格-打印Top
2 楼shleo(sky)回复于 2003-11-28 13:20:33 得分 0
我有客户端生成并下载excel文档的例子
需不需要
需要的话给个信箱地址Top
3 楼ny_nicholas()回复于 2003-11-28 13:52:39 得分 0
我要!!先謝了!
ny_nicholas@hotmail.comTop
4 楼kokblack(人人为我,我为人人)回复于 2003-11-28 14:28:19 得分 0
也给偶一份!
kokzj@yahoo.com.cnTop
5 楼kokblack(人人为我,我为人人)回复于 2003-11-28 14:28:52 得分 0
http://www.yesky.com/SoftChannel/72342380468043776/20030805/1719195_1.shtmlTop
6 楼cws123(sammer)回复于 2003-11-28 14:29:29 得分 0
也给我一份!cws123@163.comTop
7 楼xxsoft(luanluan.cn or luanluan.com.cn)回复于 2003-11-28 14:50:59 得分 0
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<%
strsql="select username,email,realname,birthday,sex, mphone,homeaddr,postcode,homephone,jobaddr,jobphone,oicq,msn,website from [user]"
set rs=conn.execute(strsql)
response.ContentType = "application/vnd.ms-excel"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=classname%>同学录</title>
</head>
<body>
<table border="1" cellspacing="1" cellpadding="1">
<tr bgcolor="#999999">
<td><div align="center"><strong>真实姓名</strong></div></td>
<td><div align="center"><strong>用户名</strong></div></td>
<td><div align="center"><strong>性别</strong></div></td>
<td><div align="center"><b>生日</b></div></td>
<td><div align="center"><b>手机</b></div></td>
<td><div align="center"><strong>家庭地址</strong></div></td>
<td><div align="center"><strong>家庭电话</strong></div></td>
<td><div align="center"><strong>邮编</strong></div></td>
<td><div align="center"><strong>工作地址</strong></div></td>
<td><div align="center"><strong>工作电话</strong></div></td>
<td><div align="center"><strong>email</strong></div></td>
<td><div align="center"><strong>QQ</strong></div></td>
<td><div align="center"><strong>MSN</strong></div></td>
<td><div align="center"><strong>主页</strong></div></td>
</tr>
<%if not rs.eof then
do while not rs.eof%>
<tr>
<td height="20"> <% =rs("realname")%> </td>
<td> <% =rs("username")%> </td>
<td> <% =rs("sex")%> </td>
<td> <% =rs("birthday")%> </td>
<td> <% =rs("mphone")%> </td>
<td> <% =rs("homeaddr")%> </td>
<td> <% =rs("homephone")%> </td>
<td> <% =rs("postcode")%> </td>
<td> <% =rs("jobaddr")%> </td>
<td> <% =rs("realname")%> </td>
<td> <% =rs("jobphone")%> </td>
<td> <% =rs("email")%> </td>
<td> <% =rs("oicq")%> </td>
<td> <% =rs("msn")%> </td>
</tr>
<%rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing%>
</table>
</body>
</html>
这是无错的..我主页上的..你自己拿去Top
8 楼lastest(弯弓射大雕)回复于 2003-11-28 15:35:41 得分 0
shleo(sky) 发一份给我吧,正好我现在要用,谢谢了Top
9 楼online(龙卷风V4.0--决战江湖(MS MVP-VB))回复于 2003-11-28 15:45:28 得分 0
http://www.ourfly.com/download/downloadlist.aspx?type=Asp
将数据库中的数据写入客户端的excel中Top
10 楼hshore()回复于 2003-12-08 10:29:21 得分 0
shleo(sky),还能给我发一份吗?tempeyouhhb@eyou.comTop
11 楼shayao(砂妖)回复于 2003-12-08 12:34:05 得分 0
shleo(sky),能给我发一份吗?shayao@tom.comTop
12 楼jingindream(阳光之子)回复于 2003-12-16 21:45:41 得分 0
shleo(sky):给我发一份好吗?jixinquan@163.comTop
13 楼czhncn1()回复于 2003-12-17 17:25:36 得分 0
能给我也发一份吗?我正处在学习阶段Top
14 楼czhncn1()回复于 2003-12-17 17:27:01 得分 0
不好意思忘了写有邮箱了czhncn@msn.comTop
15 楼andy2001p(火星)回复于 2003-12-17 17:43:15 得分 0
给你我做的,如果要更好的,请发邮件给我:andy2001p@hotmail.com
http://www.csdn.net/develop/read_article.asp?id=18629
Top
16 楼ilqtj(飞天)回复于 2003-12-20 12:59:10 得分 0
//一下是取数据的类
//Obj参数指定数据的来源(限定Table),默认第一行为字段名称行
//GetTableData类提供MoveNext方法,参数是表的行向上或向下移动的位数,正数向下移动,负数向上.
//GetFieldData方法获得指定的列名的数据
//Sort_desc方法对指定的列按降序排列
//Sort_asc方法对指定的列按升序排列
//GetData方法返回字段值为特定值的数据数组,提供数据,可以在外部进行其他处理
//Delete方法删除当前记录,数组减少一行
//初始化,Obj:table的名字,Leftlen:左面多余数据长度,Rightlen:右面多余数据长度,
function GetTableData(Obj,LeftLen,RightLen){
var MyObj=document.all(Obj);
var iRow=MyObj.rows.length;
var iLen=MyObj.rows[0].cells.length;
var i,j;
TableData=new Array();
for (i=0;i< iRow;i++){
TableData[i]=new Array();
for (j=0;j<iLen;j++){
TableStr=MyObj.rows(i).cells(j).innerText;
TableStr=TableStr.substring(LeftLen, TableStr.length-RightLen).Trim();
TableStr=TableStr.replace(/ /gi,"").replace(//r/n/ig,"");
TableData[i][j]=TableStr;
}
}
this.TableData=TableData;
this.cols=this.TableData[0].length;
this.rows=this.TableData.length;
this.rowindex=0;
}
function movenext(Step){
if (this.rowindex>=this.rows){
return
}
if (Step=="" || typeof(Step)=="undefined") {
if (this.rowindex<this.rows-1)
this.rowindex++;
return;
}
else{
if (this.rowindex + Step<=this.rows-1 && this.rowindex + Step>=0 ){
this.rowindex=this.rowindex + Step;
}
else
{
if (this.rowindex + Step<0){
this.rowindex= 0;
return;
}
if (this.rowindex + Step>this.rows-1){
this.rowindex= this.rows-1;
return;
}
}
}
}
function getfielddata(Field){
var colindex=-1;
var i=0;
if (typeof(Field) == "number"){
colindex=Field;
}
else
{
for (i=0;i<this.cols && this.rowindex<this.rows ;i++){
if (this.TableData[0][i]==Field){
colindex=i;
break;
}
}
}
if (colindex!=-1) {
return this.TableData[this.rowindex][colindex];
}
}
function sort_desc(){//降序
var colindex=-1;
var highindex=-1;
desc_array=new Array();
var i,j;
for (n=0; n<arguments.length; n++){
Field=arguments[arguments.length-1-n];
for (i=0;i<this.cols;i++){
if (this.TableData[0][i]==Field){
colindex=i;
break;
}
}
if ( colindex==-1 )
return;
else
{
desc_array[0]=this.TableData[0];
for(i=1;i<this.rows;i++){
desc_array[i]=this.TableData[1];
highindex=1;
for(j=1;j<this.TableData.length;j++){
if (desc_array[i][colindex]<this.TableData[j][colindex]){
desc_array[i]=this.TableData[j];
highindex=j;
}
}
if (highindex!=-1)
this.TableData=this.TableData.slice(0,highindex).concat(this.TableData.slice(highindex+1,this.TableData.length));
}
}
this.TableData=desc_array;
}
return;
}
function sort_asc(){//升序
var colindex=-1;
var highindex=-1;
var i,j;
for (n=0; n<arguments.length; n++){
asc_array=new Array();
Field=arguments[arguments.length-1-n];
for (i=0;i<this.cols;i++){
if (this.TableData[0][i]==Field){
colindex=i;
break;
}
}
if ( colindex==-1 )
return;
else
{
asc_array[0]=this.TableData[0];
for(i=1;i<this.rows;i++){
asc_array[i]=this.TableData[1];
highindex=1;
for(j=1;j<this.TableData.length;j++){//找出最小的列值
if (asc_array[i][colindex]>this.TableData[j][colindex]){
asc_array[i]=this.TableData[j];
highindex=j;
}
}
if (highindex!=-1)
this.TableData=this.TableData.slice(0,highindex).concat(this.TableData.slice(highindex+1,this.TableData.length));
}
}
this.TableData=asc_array;
}
return;
}
function getData(Field,FieldValue){
var colindex=-1;
var i,j;
GetData=new Array();
if (typeof(Field)=="undefined" || typeof(FieldValue)=="undefined" ){
return this.TableData;
}
for(j=0;j<this.cols;j++){
if (this.TableData[0][j]==Field){
colindex=j;
}
}
if (colindex!=-1){
for(i=1;i<this.rows;i++){
if (this.TableData[i][colindex]==FieldValue){
GetData[i]=new Array();
GetData[i]=this.TableData[i];
}
}
}
return GetData;
}
function DeletE(){
this.TableData=this.TableData.slice(0,this.rowindex).concat(this.TableData.slice(this.rowindex+1,this.TableData.length));
this.rows=this.TableData.length;
return;
}
function updateField(Field,FieldValue){
var colindex=-1;
var i=0;
if (typeof(Field) == "number"){
colindex=Field;
}
else
{
for (i=0;i<this.cols && this.rowindex<this.rows ;i++){
if (this.TableData[0][i]==Field){
colindex=i;
break;
}
}
}
if (colindex!=-1) {
this.TableData[this.rowindex][colindex]=FieldValue;
}
}
function movefirst(){
this.rowindex=0;
}
function movelast(){
this.rowindex=this.rows-1;
}
function String.prototype.Trim() {return this.replace(/(^/s*)|(/s*$)/g,"");}
GetTableData.prototype.MoveNext = movenext;
GetTableData.prototype.GetFieldData = getfielddata;
GetTableData.prototype.Sort_asc = sort_asc;
GetTableData.prototype.Sort_desc = sort_desc;
GetTableData.prototype.GetData = getData;
GetTableData.prototype.Delete = DeletE;
GetTableData.prototype.UpdateField = updateField;
GetTableData.prototype.MoveFirst = movefirst;
具体的例子:http://202.119.73.208/NetEAn/com/test/jsprint.htm