已阅读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年山东证监局验收考试试题及答案
- 武汉低碳城市建设路径与成效研究:基于可持续发展视角
- 武夷山不同海拔植被带土壤微生物量碳、氮、磷的特征与生态关联探究
- 2026年钳工初级理论考试试题及答案
- 正加速度暴露对大鼠实验性胃溃疡愈合的黏膜血流机制解析
- 2026年环境保洁资质考试试题及答案
- 欧盟财政政策协调:挑战、变革与展望
- 欧元区扩大的经济涟漪:对欧元国际货币地位的多维解析
- (二模)宜春市2026年高三模拟考试历史试卷(含答案)
- 储能电站设备智能运维与数据驱动技术方案
- 福建省福州市2026年中考适应性考试化学试题(含答案解析)
- 2026春统编版(新教材)小学道德与法治二年级下册(全册)各单元知识点复习课件
- 行政职业能力测试2026题库
- 按劳分配为主体、多种分配方式并存课件-2025-2026学年统编版道德与法治八年级下册
- 街道行政执法监督制度
- 遗传的物质基础课件文库
- 【量子位智库】2025年度具身智能创业投融资全景报告
- 城市内涝风险评估方案
- 江西省国有资本运营控股集团有限公司2026年第一批批次公开招聘参考考试试题附答案解析
- 2025春季日照银行校园招聘考察人员笔试历年典型考题及考点剖析附带答案详解
评论
0/150
提交评论