asp中能否实现用户从界面导入word和excel文件,并以html格式展示出来 20
如题,asp系统中的一个功能,用户将EXCEL或WORD文件导入系统,转换为HTML展示,并可根据导入时间查询。并且该文件内容用户可以撤回更改。谢谢“沙漠之鹰”的回复,不...
如题,asp系统中的一个功能,用户将EXCEL或WORD文件导入系统,转换为HTML展示,并可根据导入时间查询。并且该文件内容用户可以撤回更改。
谢谢“沙漠之鹰”的回复,不过我的问题是“将EXCEL或WORD文件导入系统,转换为HTML展示,并可根据导入时间查询。并且该文件内容用户可以撤回更改。”。 而不是将表格导出excel或word 展开
谢谢“沙漠之鹰”的回复,不过我的问题是“将EXCEL或WORD文件导入系统,转换为HTML展示,并可根据导入时间查询。并且该文件内容用户可以撤回更改。”。 而不是将表格导出excel或word 展开
展开全部
<html>
<head>
<title>看看</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋体";
font-size: 9pt;
}
</style>
</head>
<body >
<center class="Noprint" >
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>
</p>
<p> <input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>
<br/>
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td colspan="3" class="tdp">第1页</td>
</tr>
<tr>
<td width="29%" class="tdp"> </td>
<td width="28%" class="tdp"> </td>
<td width="43%" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" >
<!--分页-->
<div class="PageNext"></div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第2页</td>
</tr>
<tr>
<td class="tdp">看到分页了吧</td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
__________________________________________________________________
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<TABLE id="data" border="1">
<TR>
<TD><B>asdfaf</B></TD>
<TD><B>asfafaf</B></TD>
</TR>
<TR>
<TD>asdfaf</TD>
<TD>asfafaf</TD>
</TR>
</TABLE>
<input type="button" name="out_word" onclick="vbscript:buildDoc" value="导出到word" class="notPrint">
<script language="vbscript">
Sub buildDoc
set table = document.all.data
row = table.rows.length
column = table.rows(1).cells.length
Set objWordDoc = CreateObject("Word.Document")
'objWordDoc.Application.Documents.Add theTemplate, False
objWordDoc.Application.Visible=True
Dim theArray(20,10000)
for i=0 to row-1
for j=0 to column-1
theArray(j+1,i+1) = table.rows(i).cells(j).innerTEXT
next
next
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("综合查询结果集") //显示表格标题
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range
With rngPara
.Bold = True //将标题设为粗体
.ParagraphFormat.Alignment = 1 //将标题居中
.Font.Name = "隶书" //设定标题字体
.Font.Size = 18 //设定标题字体大小
End With
Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range
Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,row,column)
for i = 1 to column
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1
next
For i =1 to column
For j = 2 to row
objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.InsertAfter theArray(i,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.ParagraphFormat.alignment=1
Next
Next
End Sub
</SCRIPT>
</BODY>
</HTML>
这段程序可以把ASP中的表格导入到Word中,看看能不能对你有点帮助
----------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>看看</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><!--media=print 这个属性可以在打印时有效-->
<STYLE media=print>.Noprint {
DISPLAY: none
}
.PageNext {
PAGE-BREAK-AFTER: always
}
</STYLE>
<STYLE>.tdp {
BORDER-RIGHT: #ffffff 0px solid; BORDER-TOP: #ffffff 0px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid
}
.tabp {
BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid
}
.NOPRINT {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
</STYLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<CENTER class=Noprint>
<P>
<OBJECT id=WebBrowser height=0 width=0
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT><INPUT onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印>
<INPUT onclick=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印> <INPUT onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置> </P>
<P><INPUT onclick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览>
<BR></P>
<HR align=center width="90%" noShade SIZE=1>
</CENTER>
<TABLE class=tabp cellSpacing=0 cellPadding=2 width="90%" align=center
border=0><TBODY>
<TR>
<TD class=tdp colSpan=3>第1页</TD></TR>
<TR>
<TD class=tdp width="29%"> </TD>
<TD class=tdp width="28%"> </TD>
<TD class=tdp width="43%"> </TD></TR>
<TR>
<TD class=tdp colSpan=3> </TD></TR>
<TR>
<TD class=tdp colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=tdp width="50%">
<P>这样的报表</P>
<P>对一般的要求就够了。</P></TD>
<TD> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<HR class=NOPRINT align=center width="90%" noShade SIZE=1>
<!--分页-->
<DIV class=PageNext></DIV>
<TABLE class=tabp cellSpacing=0 cellPadding=2 width="90%" align=center
border=0><TBODY>
<TR>
<TD class=tdp>第2页</TD></TR>
<TR>
<TD class=tdp>看到分页了吧</TD></TR>
<TR>
<TD class=tdp> </TD></TR>
<TR>
<TD class=tdp> </TD></TR>
<TR>
<TD class=tdp>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=tdp width="50%">
<P>这样的报表</P>
<P>对一般的要求就够了。</P></TD>
<TD> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
<head>
<title>看看</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋体";
font-size: 9pt;
}
</style>
</head>
<body >
<center class="Noprint" >
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>
</p>
<p> <input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>
<br/>
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td colspan="3" class="tdp">第1页</td>
</tr>
<tr>
<td width="29%" class="tdp"> </td>
<td width="28%" class="tdp"> </td>
<td width="43%" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" >
<!--分页-->
<div class="PageNext"></div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第2页</td>
</tr>
<tr>
<td class="tdp">看到分页了吧</td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
__________________________________________________________________
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<TABLE id="data" border="1">
<TR>
<TD><B>asdfaf</B></TD>
<TD><B>asfafaf</B></TD>
</TR>
<TR>
<TD>asdfaf</TD>
<TD>asfafaf</TD>
</TR>
</TABLE>
<input type="button" name="out_word" onclick="vbscript:buildDoc" value="导出到word" class="notPrint">
<script language="vbscript">
Sub buildDoc
set table = document.all.data
row = table.rows.length
column = table.rows(1).cells.length
Set objWordDoc = CreateObject("Word.Document")
'objWordDoc.Application.Documents.Add theTemplate, False
objWordDoc.Application.Visible=True
Dim theArray(20,10000)
for i=0 to row-1
for j=0 to column-1
theArray(j+1,i+1) = table.rows(i).cells(j).innerTEXT
next
next
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("综合查询结果集") //显示表格标题
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range
With rngPara
.Bold = True //将标题设为粗体
.ParagraphFormat.Alignment = 1 //将标题居中
.Font.Name = "隶书" //设定标题字体
.Font.Size = 18 //设定标题字体大小
End With
Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range
Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,row,column)
for i = 1 to column
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1
next
For i =1 to column
For j = 2 to row
objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.InsertAfter theArray(i,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.ParagraphFormat.alignment=1
Next
Next
End Sub
</SCRIPT>
</BODY>
</HTML>
这段程序可以把ASP中的表格导入到Word中,看看能不能对你有点帮助
----------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>看看</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><!--media=print 这个属性可以在打印时有效-->
<STYLE media=print>.Noprint {
DISPLAY: none
}
.PageNext {
PAGE-BREAK-AFTER: always
}
</STYLE>
<STYLE>.tdp {
BORDER-RIGHT: #ffffff 0px solid; BORDER-TOP: #ffffff 0px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid
}
.tabp {
BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid
}
.NOPRINT {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
</STYLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<CENTER class=Noprint>
<P>
<OBJECT id=WebBrowser height=0 width=0
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT><INPUT onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印>
<INPUT onclick=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印> <INPUT onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置> </P>
<P><INPUT onclick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览>
<BR></P>
<HR align=center width="90%" noShade SIZE=1>
</CENTER>
<TABLE class=tabp cellSpacing=0 cellPadding=2 width="90%" align=center
border=0><TBODY>
<TR>
<TD class=tdp colSpan=3>第1页</TD></TR>
<TR>
<TD class=tdp width="29%"> </TD>
<TD class=tdp width="28%"> </TD>
<TD class=tdp width="43%"> </TD></TR>
<TR>
<TD class=tdp colSpan=3> </TD></TR>
<TR>
<TD class=tdp colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=tdp width="50%">
<P>这样的报表</P>
<P>对一般的要求就够了。</P></TD>
<TD> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<HR class=NOPRINT align=center width="90%" noShade SIZE=1>
<!--分页-->
<DIV class=PageNext></DIV>
<TABLE class=tabp cellSpacing=0 cellPadding=2 width="90%" align=center
border=0><TBODY>
<TR>
<TD class=tdp>第2页</TD></TR>
<TR>
<TD class=tdp>看到分页了吧</TD></TR>
<TR>
<TD class=tdp> </TD></TR>
<TR>
<TD class=tdp> </TD></TR>
<TR>
<TD class=tdp>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=tdp width="50%">
<P>这样的报表</P>
<P>对一般的要求就够了。</P></TD>
<TD> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询