已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
aspexcel(excel).txt37 public property let createtype(byval val) if val 1 and val 2 then createtype_ = 1 else createtype_ = val end if end property public property let data(byval val) if not isarray(val) then inerr() end if exceldata = val end property public property get savepath() savepath = savepath_ end property public property get usedtime() usedtime = usedtime_ end property public property let sheetname(byval val) if not isarray(val) then if val = then inerr() end if titlefirstline = true else redim titlefirstline(ubound(val) dim ik_ for ik_ = 0 to ubound(val) titlefirstline(ik_) = true next end if sheetname_ = val end property public property let sheettitle(byval val) if not isarray(val) then if val = then inerr() end if end if sheettitle_ = val end property rem private sub checkdata() if savepath_ = then inerr() if not isarray(sheetname_) then if sheetname_ = then inerr() end if if createtype_ = 2 then if not isarray(exceldata) then inerr() end if exit sub end if if isarray(sheetname_) then if not isarray(sheettitle_) then if sheettitle_ then inerr() end if end if if not isarray(exceldata) then inerr() end if if isarray(sheetname_) then if getarraydim(exceldata) 1 then inerr() else if getarraydim(exceldata) 2 then inerr() end if end sub rem excel public function create() call checkdata() if not isnull(readpath_) then excelapp.workbooks.open(readpath_) else excelapp.workbooks.add end if set excelbook = excelapp.activeworkbook set excelsheets = excelbook.worksheets if createtype_ = 2 then dim ih_ for ih_ = 0 to ubound(exceldata) call setsheets(exceldata(ih_), ih_) next excelbook.saveas savepath_ usedtime_ = formatnumber(timer - usedtime_)*1000, 3) exit function end if if isarray(sheetname_) then dim ik_ for ik_ = 0 to ubound(exceldata) call createsheets(exceldata(ik_), ik_) next else call createsheets(exceldata, -1) end if excelbook.saveas savepath_ usedtime_ = formatnumber(timer - usedtime_)*1000, 3) end function private sub createsheets(byval data_, dataid_) dim spreadsheet dim tempsheettitle dim temptitlefirstline if dataid_-1 then if dataid_ excelsheets.count - 1 then excelsheets.add() set spreadsheet = excelbook.sheets(1) else set spreadsheet = excelbook.sheets(dataid_ + 1) end if if isarray(sheettitle_) then tempsheettitle = sheettitle_(dataid_) else tempsheettitle = end if temptitlefirstline = titlefirstline(dataid_) = sheetname_(dataid_) else set spreadsheet = excelbook.sheets(1) = sheetname_ tempsheettitle = sheettitle_ temptitlefirstline = titlefirstline end if dim line_ : line_ = 1 dim rownum_ : rownum_ = ubound(data_, 1) + 1 dim lastcols_ if tempsheettitle then spreadsheet.columns(1).shrinktofit=true ( lastcols_ = getcolname(ubound(data_, 2) + 1) with spreadsheet.cells(1, 1) .value = tempsheettitle excel .font.bold = true .font.italic = false .font.size = 20 .= .font.colorindex=2 2 end with with spreadsheet.range(a1:& lastcols_ &1) .merge () .interior.colorindex = 1 .horizontalalignment = 3 end with line_ = 2 rownum_ = rownum_ + 1 end if dim irow_, icol_ dim drow_, dcol_ dim templastrange : templastrange = getcolname(ubound(data_, 2)+1) & (rownum_) dim beginrow : beginrow = 1 if tempsheettitle then beginrow = beginrow + 1 if temptitlefirstline = true then beginrow = beginrow + 1 if beginrow=1 then with spreadsheet.range(a1:& templastrange) .borders.linestyle = 1 .borderaround -4119, -4138 .numberformatlocal = .font.bold = false .font.italic = false .font.size = 10 .shrinktofit=true end with else with spreadsheet.range(a1:& templastrange) .borders.linestyle = 1 .borderaround -4119, -4138 .shrinktofit=true end with with spreadsheet.range(a& beginrow &:& templastrange) .numberformatlocal = .font.bold = false .font.italic = false .font.size = 10 end with end if if temptitlefirstline = true then beginrow = 1 if tempsheettitle then beginrow = beginrow + 1 with spreadsheet.range(a& beginrow &:& getcolname(ubound(data_, 2)+1) & (beginrow) .numberformatlocal = .font.bold = true .font.italic = false .font.size = 12 .interior.colorindex = 37 .horizontalalignment = 3 .font.colorindex=2 end with end if for irow_ = line_ to rownum_ for icol_ = 1 to (ubound(data_, 2) + 1) dcol_ = icol_ - 1 if tempsheettitle then drow_ = irow_ - 2 else drow_ = irow_ - 1 if not isnull(data_(drow_, dcol_) then with spreadsheet.cells(irow_, icol_) .value = data_(drow_, dcol_) end with end if next next set spreadsheet = nothing end sub rem private function isobjinstalled(strclassstring) on error resume next isobjinstalled = false err = 0 dim xtestobj set xtestobj = server.createobject(strclassstring) if 0 = err then isobjinstalled = true set xtestobj = nothing err = 0 end function rem private function getarraydim(byval arr) getarraydim = null dim i_, temp if isarray(arr) then for i_ = 1 to 60 on error resume next temp = ubound(arr, i_) if err.number 0 then getarraydim = i_ - 1 err.clear exit function end if next getarraydim = i_ end if end functionclass createexcel private createtype_ private savepath_ private readpath_ private authorstr rem private versionstr rem private systemstr rem private sheetname_ rem private sheettitle_ rem private exceldata rem private excelapp rem excel.application private excelbook private excelsheets private usedtime_ rem public titlefirstline rem private sub class_initialize() server.scripttimeout = 99999 usedtime_ = timer systemstr = lc00_createexcelserver authorstr = surnfu 31333716 versionstr = 1.0 if not isobjinstalled(excel.application) then inerr(excel.application) end if set excelapp = createobject(excel.a
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《人工智能通识教程》习题及答案 胡丽莹
- 2026年交通局交通综合知识单套全真试卷道路法规专项考题精粹
- DB31-T 1626-2025 鲜食黄桃质量评价指南
- 2026年事业单位考试《公共基础知识》冲刺押题卷
- 2026年事业单位考试教师岗位专项训练
- 2026年税务师考试涉税业务知识冲刺押题试卷
- 人教版数学八年级下册 山东省滨州市滨城区 期末考试 含答案
- 小车笔试题及参考答案
- 2026年人力资源管理师考试《人力资源管理》模拟试卷解析
- 2026秋新版小学湘科版科学五年级上册教学计划、教学设计(附目录)适用于新课标
- 内分泌影像学
- fde+行业研究报告-霞光智库-202609
- 液化气站安全试题及答案
- 江苏省常州市2026年中考数学试卷(含答案)
- 各快递公司应急预案(3篇)
- 上午《中职班主任工作与心理健康教育》
- 2026年国庆节祖国发展成就课件
- 爆破及拆除工程安全生产事故专项应急预案
- 2026年新教师备课说课评课指导课件(高清可编辑课件)
- 长江产业投资集团招聘笔试题目答案解析
- GB/T 13578-2026橡胶塑料压延机
评论
0/150
提交评论