社区
ASP
帖子详情
关于EXCEL的问题,大侠请进来拿分!
super_paladin
2005-09-27 10:47:19
在生成WEB表格的同时(表格比较复杂,不能根据坐标输出),生成一个相同内容的excel文件,保存在服务器端,用户根据需要下载excel格式的文件。
...全文
105
5
打赏
收藏
关于EXCEL的问题,大侠请进来拿分!
在生成WEB表格的同时(表格比较复杂,不能根据坐标输出),生成一个相同内容的excel文件,保存在服务器端,用户根据需要下载excel格式的文件。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
super_paladin
2005-09-29
打赏
举报
回复
楼上的有具体的例子吗,我不知道怎样把要输出的table内容存入到一个变量中.如果要输出的内容太多,会造成溢出吗?
HHH3000
2005-09-27
打赏
举报
回复
非常简单,在生成报表的同时,把报表的html(table内容)写入一个变量,
然后用fso把它写入一个文件,后缀改成xls,记录下文件地址,
这时用户点击下载,就连接到这个文件地址就可以了。
尚和空四
2005-09-27
打赏
举报
回复
一个完整的例子 仔细研究 研究
尚和空四
2005-09-27
打赏
举报
回复
ReportFile = ReportFile & ".xls"
' Start Excel and get Application object.
Set oXL = server.createobject("excel.application")
' oXL.Visible = True
' Get a new workbook.
Set oWB = oXL.Workbooks.Add
Set oSheet = oWB.ActiveSheet
'ActiveWorkbook.Sheets("Sheet1").Select
Set oSheet = oWB.ActiveSheet
oSheet.Activate
'------------------------------------------------------
'------------- column align,font,size--
'xlHAlignLeft(-4131) xlHAlignRight(-4152) xlHAlignCenter(-4108) xlVAlignCenter(-4108)
oSheet.Columns.Font.Name = "Verdana"
oSheet.Columns(1).ColumnWidth = 15
oSheet.Columns(1).HorizontalAlignment = -4131
oSheet.Columns(1).Font.Size = 9
oSheet.Columns(2).ColumnWidth = 15
oSheet.Columns(2).HorizontalAlignment = -4131
oSheet.Columns(2).Font.Size = 9
oSheet.Columns(3).HorizontalAlignment = -4131
oSheet.Columns(3).Font.Size = 9
oSheet.Columns(4).ColumnWidth = 35
oSheet.Columns(4).HorizontalAlignment = -4131
oSheet.Columns(4).Font.Size = 9
oSheet.Columns(5).ColumnWidth = 20
oSheet.Columns(5).HorizontalAlignment = -4131
oSheet.Columns(5).Font.Size = 9
oSheet.Columns(6).ColumnWidth = 20
oSheet.Columns(6).HorizontalAlignment = -4131
oSheet.Columns(6).Font.Size = 9
'--------------------------------
oSheet.Name = "Weekly Report of " & reporter
intLine = 1
oSheet.Range("A" & intLine, "G" & intLine).Merge
oSheet.Cells(intLine, 1).HorizontalAlignment = -4108
oSheet.Cells(intLine, 1).Font.Size = 10
oSheet.Cells(intLine, 1).Font.Bold = True
oSheet.Cells(intLine, 1).Font.Underline = True
oSheet.Cells(intLine, 1).Font.Background = 1
oSheet.Cells(intLine, 1).Value = "Weekly Report of " & reporter & " (" & weekstartdate & "-" & weekenddate & ")"
intLine = 3
'----------------------------------------------------------------------------------------
oSheet.Range("A" & intLine, "F" & intLine).Merge
oSheet.Cells(intLine, 1).HorizontalAlignment = -4131
oSheet.Cells(intLine, 1).Font.Size = 10
oSheet.Cells(intLine, 1).Font.Bold = True
oSheet.Cells(intLine, 1).Font.Underline = True
oSheet.Cells(intLine, 1).Font.Background = 1
oSheet.Cells(intLine, 1).Interior.color = rgb(207,216,236)
oSheet.Cells(intLine, 1).Value = "Jobs have been done in this week"
intLine = intLine + 1
oSheet.Cells(intLine, 1).Value = "Job Name."
oSheet.Cells(intLine, 2).Value = "Progress"
oSheet.Cells(intLine, 3).Value = "Status"
oSheet.Cells(intLine, 4).Value = "Desc."
oSheet.Cells(intLine, 5).Value = "Actual Start/Finish Date"
oSheet.Cells(intLine, 6).Value = "Related Project"
With oSheet.Range("A" & intLine, "G" & intLine)
.Font.Bold = True
.VerticalAlignment = -4108
.HorizontalAlignment = -4108
.Font.Name = "Verdana"
.Font.Size = 9
.Font.Color = 4
End With
intLine = intLine + 1
'oSheet.Rows(1).Height = 100
oSheet.Columns(1).NumberFormat = "#"
While Not rs1.EOF
a7(0)=trim(rs1("itemname"))
a7(1)=trim(rs1("progress")) & "%"
a7(2)=getsysparam("jobstatus",trim(rs1("status")))
a7(3)=replace(trim(rs1("remark")),chr(13),"")
a7(4)=getdatestyle(trim(rs1("astartdate")),trim(rs1("aenddate")))
a7(5)=getproject(trim(rs1("jitemid")))
oSheet.Cells(intLine, 1).Value = a7(0)
oSheet.Cells(intLine, 2).Value = a7(1)
oSheet.Cells(intLine, 3).Value = a7(2)
oSheet.Cells(intLine, 4).Value = a7(3)
oSheet.Cells(intLine, 5).Value = a7(4)
oSheet.Cells(intLine, 6).Value = a7(5)
intLine = intLine + 1
rs1.MoveNext
Wend
rs1.Close
Set rs1 = Nothing
'-----------------------------------------------------------------
'----------------------------------------------------------------------------------------
intLine = intLine + 1
oSheet.Range("A" & intLine, "F" & intLine).Merge
oSheet.Cells(intLine, 1).HorizontalAlignment = -4131
oSheet.Cells(intLine, 1).Font.Size = 10
oSheet.Cells(intLine, 1).Font.Bold = True
oSheet.Cells(intLine, 1).Font.Underline = True
oSheet.Cells(intLine, 1).Font.Background = 1
oSheet.Cells(intLine, 1).Interior.color = rgb(207,216,236)
oSheet.Cells(intLine, 1).Value = "Jobs planned for next week"
intLine = intLine + 1
oSheet.Cells(intLine, 1).Value = "Job Name."
oSheet.Cells(intLine, 2).Value = "Progress"
oSheet.Cells(intLine, 3).Value = "Status"
oSheet.Cells(intLine, 4).Value = "Desc."
'oSheet.Cells(intLine, 5).Value = "Actual Start/Finish Date"
oSheet.Cells(intLine, 5).Value = "Related Project"
With oSheet.Range("A" & intLine, "F" & intLine)
.Font.Bold = True
.VerticalAlignment = -4108
.HorizontalAlignment = -4108
.Font.Name = "Verdana"
.Font.Size = 9
.Font.Color = 4
End With
intLine = intLine + 1
'oSheet.Rows(1).Height = 100
oSheet.Columns(1).NumberFormat = "#"
While Not rs2.EOF
a7(0)=trim(rs2("itemname"))
a7(1)=trim(rs2("progress")) & "%"
a7(2)=getsysparam("jobstatus",trim(rs2("status")))
a7(3)=replace(trim(rs2("remark")) ,chr(13),"")
a7(4)=getdatestyle(trim(rs2("astartdate")),trim(rs2("aenddate")))
a7(5)=getproject(trim(rs2("jitemid")))
oSheet.Cells(intLine, 1).Value = a7(0)
oSheet.Cells(intLine, 2).Value = a7(1)
oSheet.Cells(intLine, 3).Value = a7(2)
oSheet.Cells(intLine, 4).Value = a7(3)
'oSheet.Cells(intLine, 5).Value = a7(4)
oSheet.Cells(intLine, 5).Value = a7(5)
intLine = intLine + 1
rs2.MoveNext
Wend
rs2.Close
Set rs2 = Nothing
'-----------------------------------------------------------------
'----------------------------------------------------------------------------------------
intLine = intLine + 1
oSheet.Range("A" & intLine, "F" & intLine).Merge
oSheet.Cells(intLine, 1).HorizontalAlignment = -4131
oSheet.Cells(intLine, 1).Font.Size = 10
oSheet.Cells(intLine, 1).Font.Bold = True
oSheet.Cells(intLine, 1).Font.Underline = True
oSheet.Cells(intLine, 1).Font.Background = 1
oSheet.Cells(intLine, 1).Interior.color = rgb(207,216,236)
oSheet.Cells(intLine, 1).Value = "Issues"
intLine = intLine + 1
oSheet.Cells(intLine, 1).Value = "Issue Name."
oSheet.Cells(intLine, 2).Value = "Report Date"
oSheet.Cells(intLine, 3).Value = "Status"
oSheet.Cells(intLine, 4).Value = "Desc."
oSheet.Cells(intLine, 5).Value = "Owerner"
oSheet.Cells(intLine, 6).Value = "Assign to"
With oSheet.Range("A" & intLine, "G" & intLine)
.Font.Bold = True
.VerticalAlignment = -4108
.HorizontalAlignment = -4108
.Font.Name = "Verdana"
.Font.Size = 9
.Font.Color = 4
End With
intLine = intLine + 1
'oSheet.Rows(1).Height = 100
oSheet.Columns(1).NumberFormat = "#"
While Not rs3.EOF
a7(0)=trim(rs3("issuename"))
a7(1)=trim(rs3("reportdate"))
a7(2)=getsysparam("issuestatus",trim(rs3("complete")))
a7(3)=replace(trim(rs3("issuedesc")) ,chr(13),"")
a7(4)=trim(rs3("empname"))
a7(5)=getassign(trim(rs3("issueid")))
oSheet.Cells(intLine, 1).Value = a7(0)
oSheet.Cells(intLine, 2).Value = a7(1)
oSheet.Cells(intLine, 3).Value = a7(2)
oSheet.Cells(intLine, 4).Value = a7(3)
oSheet.Cells(intLine, 5).Value = a7(4)
oSheet.Cells(intLine, 6).Value = a7(5)
intLine = intLine + 1
rs3.MoveNext
Wend
rs3.Close
Set rs3 = Nothing
'-----------------------------------------------------------------
oWB.SaveAs server.MapPath("excelfile") & "\" & ReportFile
'intLine = 0
Set oRng = Nothing
Set oSheet = Nothing
Set oSheetOther = Nothing
oWB.Close
Set oWB = Nothing
Set oXL = Nothing
response.redirect "excelfile/" & ReportFile
尚和空四
2005-09-27
打赏
举报
回复
沙发
C# For Unity系列之入门篇
你想当“李逍遥”式的“
大侠
”吗? 这里无需计算机基础,无需编程经验,你也不必是计算机专业的在校大学生....只要爱好游戏,怀揣梦想! 有一定自主学习能力,跟着刘老师从“编程小白”修炼为游戏研发“大虾”吧!!...
poi
excel
带公式导出
poi
excel
导出带公式 第一,非模版读取,带公式导出,我们可以将完整的公式直接如下形式写:
excel
里面公式=ROUND(AE6-AF6-AH6-AG6,2),在java代码里面可以写成 String sixBuf = "ROUND(AE6-AF6-AH6 -AG6 ",2)"; ...
MultipartFile上传文件为NULL
刚才发现的
问题
,代码,工具包都没
问题
,file一直提示NULL 代码和
请
求都没
问题
的话,可能是
Excel
中的值和实体类类型不匹配 比如日期,
excel
中为字符串,后台实体类应该是String
Delphi与Ole,Word,
Excel
,查找与替换等
受益非浅的同时各位老兄
请
恕在下贪心的提个
问题
帖子中讨论的均是对文件的操作,但是否可以对流进行直接操作呢 比如我将DOC文件存到数据库中,现在想查看但不想生存临时文件,而是想直接利用流不知如何处理 ...
GridView导出
Excel
研究
stswordman人的梦想 是不会完结的 博客园 首页 博问 闪存 新随笔 联系 订阅 管理 随笔-152 评论-351 文章-2 trackbacks-13 ...将GridView中的数据导出为
Excel
是web应用中的常见功能。在不同的应用场景...
ASP
28,391
社区成员
357,059
社区内容
发帖
与我相关
我的任务
ASP
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
复制链接
扫一扫
分享
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章