




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025河南安阳市疾病预防控制中心招聘15人模拟试卷及答案详解(有一套)
- 2025年聊城大学公开招聘人员(46名)模拟试卷完整参考答案详解
- 2025国家电网内蒙古新正产业发展有限公司全资控股公司高校毕业生招聘41人模拟试卷含答案详解
- 2025年宁夏回族自治区农业农村厅自主公开招聘事业单位急需紧缺高层次人才考前自测高频考点模拟试题及答案详解(夺冠系列)
- 2025广西河池市金城江区人民法院招聘3人考前自测高频考点模拟试题及答案详解(典优)
- 2025广东深圳市宝安区翻身实验学校(西校区)诚聘高中历史、物理等学科教师模拟试卷附答案详解(完整版)
- 2025金沙县城乡建设发展集团有限公司模拟试卷及一套答案详解
- 2025广西凌云县新活力劳务有限责任公司招聘1人考前自测高频考点模拟试题及答案详解(考点梳理)
- 2025吉林吉林市事业单位招聘(含专项招聘高层次高校毕业生)1381人(1号)模拟试卷及答案详解(新)
- 2025年福建省福州市闽侯县振兴一乡村集团有限公司招聘48人考前自测高频考点模拟试题及完整答案详解
- 2025年书记在公文抄袭问题专项整治工作会议上的讲话范文
- GB/T 17219-2025生活饮用水输配水设备、防护材料及水处理材料卫生安全评价
- 出差工作安全培训课件
- 占道施工安全培训内容课件
- 2025年少先队大队委笔试试卷及答案
- 证券业反洗钱培训课件
- GJB3165A-2020航空承力件用高温合金热轧和锻制棒材规范
- 2025年执业药师考试题库大全-附答案
- 退换货方案及措施
- 2025年食药监局考试题库
- 密室逃脱消防应急预案
评论
0/150
提交评论