急需高手请教关于页面表格数据转换为WORD文档问题!

ccjh623 2010-05-24 01:02:58
下面是小弟编的页面表格数据转换为WORD文档的代码。
问题一表格上有图片格式JPG,为什么图片在页面上可以显示出来,转换为WORD就显示不出来,急需各位高手指教;
问题二小弟的页面表格数据是采用分页显示的,为什么转换为WORD文档时只转换第一页的页面表格数据而其他页的没转换,哪位高手能教下小弟怎样才能把页面数据全部转换为WORD,如果数据太多的话怎么才能使WORD分页显示。
<!--#include file="conn.asp"-->
<%
dim ljbh,ljmc,gxh
ljbh= Request.QueryString("ljbh")
ljmc=request.querystring("ljmc")
gxh=request.querystring("gxh")
%>
<%
Response.ContentType = "application/vnd.msword"
Response.AddHeader "Content-Disposition","attachment;filename="&gxh&".doc"
response.buffer=true
response.expires=0
%>
<%
' 注释:创建并初始化Recordset对象
Set rst = Server.CreateObject("ADODB.Recordset")
rst.ActiveConnection = Conn
rst.Source = "SELECT * FROM 过程卡1 where ljbh='" & ljbh & "' and ljmc='"&ljmc&"'"
rst.CursorType = 3 ' 指针类型为静态指针
rst.Open
if rst.EOF then
response.write("无纪录!")
else
rst.PageSize =1
If Request("DisplayPage") = "" then ' 没有DisplayPage参数
CurPage = 1 ' 定义要显示的页码
Else
CurPage = CInt(Request("DisplayPage"))
End if
For i = 1 to rst.PageSize
If rst.EOF then Exit For ' 没有记录时提前退出
%>

<table width="860" border="1" align="center">
<tr>
<td width="300" rowspan="2"><div align="center" class="STYLE1">工 序 卡 片</div></td>
<td height="20" colspan="2"><div align="center" class="STYLE5 STYLE5">共<% =rst.PageCount %>页</div></td>
<td colspan="2"><div align="center">第 页</div></td>
<%
sql="select * from gckxx where ljbh='" & ljbh & "' and ljmc='"&ljmc&"'"
Set rst= Server.CreateObject("ADODB.Recordset")
rst.open sql,conn
%>
<td width="70"><div align="center" class="STYLE5 STYLE5">产品名称</div></td>
<td width="70"><div align="center" class="STYLE5 STYLE5"><%=RST("cpmc")%></div></td>
<td width="70"><div align="center" class="STYLE5 STYLE5">坯料牌号</div></td>
<td width="70"><div align="center" class="STYLE5 STYLE5"><%=RST("clmchph")%></div></td>
</tr>
<tr>
<%
dim sql1
sql1="select * from 过程卡1 where ljbh='" & ljbh & "' and ljmc='"&ljmc&"'and gxh='"&gxh&"'"
Set rst= Server.CreateObject("ADODB.Recordset")
rst.open sql1,conn
%>
<td width="70" height="20"><div align="center" class="STYLE5 STYLE5">零件名称</div></td>
<td width="70"><div align="center" class="STYLE5 STYLE5"><%=RST("ljmc")%></div></td>
<td width="70"><div align="center" class="STYLE5 STYLE5">零件图号</div></td>
<td width="70"><div align="center" class="STYLE5 STYLE5"><%=RST("ljbh")%></div></td>
<td><div align="center" class="STYLE5 STYLE5">单 件</div></td>
<td><div align="center" class="STYLE5 STYLE5"><%=RST("djgsh")%></div></td>
<td><div align="center" class="STYLE5 STYLE5">辅 助</div></td>
<td><div align="center" class="STYLE5 STYLE5"><%=RST("zhjgsh")%></div></td>
</tr>
</table>
<table width="860" border="1" align="center">
<tr>
<td width="90" rowspan="2"><div align="center" class="STYLE3">第<%=RST("gxh")%>道工序</div></td>
<td width="50" rowspan="2"><div align="center" class="STYLE3">机床</div> <div align="center" class="STYLE3">设备</div></td>
<td width="50"><div align="center" class="STYLE3">名称</div></td>
<td width="110"><div align="center" class="STYLE3"><%=RST("jichuang")%></div></td>
<td width="50" rowspan="2"><div align="center" class="STYLE3">夹具</div> <div align="center" class="STYLE3">名称</div></td>
<td width="50"><div align="center" class="STYLE3">名称</div></td>
<td width="110"><div align="center" class="STYLE3"><%=RST("jiaju")%></div></td>
<td width="50"><div align="center" class="STYLE3">工序</div></td>
<td width="300" rowspan="2"><div align="center" class="STYLE3"><%=RST("jgneirong")%></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE3">编号</div></td>
<td><div align="center" class="STYLE3"><%=RST("jichuangdaihao")%></div></td>
<td><div align="center" class="STYLE3">编号</div></td>
<td><div align="center" class="STYLE3"><%=RST("jiajudaihao")%></div></td>
<td><div align="center" class="STYLE3">内容</div></td>
</tr>
</table>

<table width="860" border="1" align="center">
<tr>
<td width="350" rowspan="19"><label><img src="images/<%=RST("tu")%>" width="330" height="400" alt="" /></label></td> 图片显示代码

<td width="30" rowspan="2"><div align="center" class="STYLE4">工</div>
<div align="center" class="STYLE4">步</div></td>
<td width="150" rowspan="2"><div align="center" class="STYLE4">工步内容</div></td>
<td width="110"><div align="center" class="STYLE4">刀 刃 具</div></td>
<td width="110"><div align="center" class="STYLE4">辅  具</div></td>
<td width="110"><div align="center" class="STYLE4">量  具</div></td>
</tr>
<tr>
<td><div align="center" class="STYLE4">名称及编号</div></td>
<td><div align="center" class="STYLE4">名称及编号</div></td>
<td><div align="center" class="STYLE4">名称及编号</div></td>
</tr>
<%
dim sql2
sql1="select * from 工序1 where ljbh='" & ljbh & "' and ljmc='"&ljmc&"'and gxh='"&gxh&"' and gb='1'"
Set rst= Server.CreateObject("ADODB.Recordset")
rst.open sql1,conn
if rst.EOF then
%>
<tr>
<%
response.write("【该工序未编!】")
else
%>
<td height="30"><div align="center" class="STYLE4"><%=RST("gb")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("gbneirong")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("daoju")%><%=RST("daojudaihao")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("jiaju")%><%=RST("jiajudaihao")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("liangju")%><%=RST("liangjudaihao")%></div></td>
</tr>
<%
end if
%>
<%
dim sql3
sql1="select * from 工序1 where ljbh='" & ljbh & "' and ljmc='"&ljmc&"'and gxh='"&gxh&"' and gb='2'"
Set rst= Server.CreateObject("ADODB.Recordset")
rst.open sql1,conn
if rst.EOF then
%>
<tr>
<td height="30"> </td>
<td height="30"> </td>
<td height="30"> </td>
<td height="30"> </td>
<td height="30"> </td>
</tr>
<%
else
%>
<tr>
<td height="30"><div align="center" class="STYLE4"><%=RST("gb")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("gbneirong")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("daoju")%><%=RST("daojudaihao")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("jiaju")%><%=RST("jiajudaihao")%></div></td>
<td height="30"><div align="center" class="STYLE4"><%=RST("liangju")%><%=RST("liangjudaihao")%></div></td>
<%
end if
%>
</table>
<%
dim sql10
sql10="select * from gckxx where ljbh='" & ljbh & "' and ljmc='"&ljmc&"'"
Set rst= Server.CreateObject("ADODB.Recordset")
rst.open sql10,conn
%>
<table width="860" border="1" align="center">
<tr>
<td width="460" rowspan="2"><div align="center" class="STYLE1">工艺设计管理系统</div></td>
<td width="200"><div align="center">编    制</div></td>
<td width="200"><div align="center"><%=RST("shj")%></div></td>
</tr>
<tr>
<td><div align="center">审    核</div></td>
<td width="200"><div align="center"><%=RST("shpy")%></div></td>
</tr>
</table>
<%
dim sql11
sql11="select * from 过程卡1 where ljbh='" & ljbh & "' and ljmc='"&ljmc&"' and gxh='"&gxh&"'"
Set rst= Server.CreateObject("ADODB.Recordset")
rst.open sql11,conn
%>
<p align="center" class="STYLE1"> </p>
<label></label>
<%
rst.MoveNext
Next
end if
%>
<%
rst.Close ' 关闭记录集
Set rst = Nothing
Conn.Close ' 关闭数据库连接
Set Conn = Nothing
%>
</body>
</html>
...全文
169 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
至于数据太多,WORD分页显示的问题,无需操心,WORD自然自己会分页的。

图片的问题,是因为你使用的路径。看看“相对路径”“绝对路径”这种基础知识点就知道了。
你可以尝试一下,把IMAGES图片目录拷贝到WORD文档所在目录里看看行不行。
  • 打赏
  • 举报
回复
你使用分页的话,HTML里本身就只包含数据第一页的内容,当然转换成的WORD也只包含第一页了……

解决方法:
1.直接取消分页,在HTML里返回全部数据并自动转换成WORD。
2.仍要显示第一分页数据给用户看。那就在“转换为WORD”按钮的事件里调用另一个ASP返回数据库全部数据再转换为WORD。此法两下兼得。
课题一高性能高扩展的千亿级实时数据仓库全实现 随着我们从IT时代步入DT时代,数据积累量也与日俱增,同时伴随着互联网的发展,越来越多的应用场景产生,传统的数据处理、存储方式已经不能满足日益增长的需求。而互联网行业相比传统行业对新生事物的接受度更高、应用场景更复杂, 因此基于大数据构建的数据仓库最先在互联网行业得到了尝试。 高性能高扩展的亿级电商全端实时数据仓库全实现(PC、移动、小程序) ,以热门的互联网电商实际业务应用场景为案例讲解,对电商数据仓库的常见实战指标以及难点实战指标进行了详尽讲解,具体指标包括:每日、月大盘收入报表、高付费用户分析报表、流量域多方位分析、营销域多方位分析、实时排行榜指标分析、用户主题分析、店铺主题时间区间分析等,数据分析涵盖全端(PC、移动、小程序)应用,与互联网企业大数据技术同步,让大家能够真正学到大数据企业级数据仓库的实战经验。 本课程凝聚讲师多年一线大数据企业实际项目经验,大数据企业在职架构师亲自授课,全程实操代码,带你体验真实的大数据开发过程,代码现场调试。通过本课程的学习再加上老师的答疑,你完全可以将本案例直接应用于企业。 课题二基于Flink+Hudi构建企业万亿级云上实时数据湖教程 随着互联网的发展,数据的不断膨胀,从刚开始的关系型数据库到非关系型数据库,再到大数据技术,技术的不断演进最终是随着数据膨胀而不断改变,最初的数据仓库能解决我们的问题,但是随着时代发展,企业已经不满足于数据仓库,希望有更强大的技术来支撑数据的存储,包括结构化,非结构化的数据等,希望能够积累企业的数据,从中挖掘出更大的价值。基于这个背景,数据湖的技术应运而生。 本课程基于真实的企业数据湖案例进行讲解,结合业务实现数据湖平台,让大家在实践中理解和掌握数据湖技术,未来数据湖的需求也会不断加大,希望同学们抓住这个机遇。 项目中将以热门的互联网电商业务场景为案例讲解,具体分析指标包含:流量分析,订单分析,用户行为分析,营销分析,广告分析等,能承载海量数据的实时分析,数据分析涵盖全端(PC、移动、小程序)应用。 课题三基于电商业务全链路数据中台落地方案(全渠道、全环节、全流程) 在互联网发展浪潮中,数据对于企业的价值是非常大的,怎么管理好数据,以及快速挖掘数据价值,共享数据价值,急需一套解决方案,在数据开发中,核心数据模型的变化是相对缓慢的,同时,对数据进行维护的工作量也非常大;但业务创新的速度、对数据提出的需求的变化,是非常快速的。数据中台的出现,就是为了弥补数据开发和应用开发之间,由于开发速度不匹配,出现的响应力跟不上的问题数据中台解决的问题,包括:效率问题、协作问题、能力问题数据中台是聚合和治理跨域数据,将数据抽象封装成服务,提供给前台以业务价值的逻辑概念。 本课程基于真实企业数据中台建设架构进行讲解,带大家构建数据中台,通过学习完本课程可以节省你摸索的时间,节省企业成本,提高企业开发效率。 课程包含几大模块:数据源管理、数据接入管理、数据质量管理、数据质量报告、数据安全管理、数据查询IDE、数据血缘以及元数据管理、数据中台实战应用等,对于数据中台涉及到的业务以及技术进行详尽的讲解。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧