版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、asp? de ?excel ?(? ud ?excel2? i ?ed y o | o ?).txt37?3? e ? d ? ? Y? ? ? do ?3? e ?e ? u ? |? d?2? ou ? dd ? ?3? e ? e ? ? oue ? ?e ?o Dod ?public property let createtype(byval val)if val 1 and val 2 thencreatetype_ = 1elsecreatetype_ = valend ifend propertypublic property let data(byval val)if not
2、 isarray(val) theninerr(ie y?Yee ? o D?o )end ifexceldata = valend propertypublic property get savepath()savepath = savepath_end propertypublic property get usedtime()usedtime = usedtime_end propertypublic property let sheetname(byval val)if not isarray(val) thenif val = theninerr( ? ee ? o D?o )end
3、 iftitlefirstline = trueelseredim titlefirstline(ubound(val)dim ik_for ik_ = 0 to ubound(val)titlefirstline(ik_) = truenextend ifsheetname_ = valend propertypublic property let sheettitle(byval val)if not isarray(val) thenif val = theninerr(土 ei aee ? o D?o )end ifend ifsheettitle_ = valend property
4、rem ?1 2ee y?Yprivate sub checkdata()if savepath_ = then in err( ? ?2? u ?a?)if not isarray(sheetname_) thenif sheetname_ = then inerr( ?2? u ?a?)end ifif createtype_ = 2 thenif not isarray(exceldata) theninerr(e y?Y?e ?i ?o ? o ? ? e ?)end ifexit subend ifif isarray(sheetname_) thenif not isarray(s
5、heettitle_) thenthenthenthenifsheettitle_in err(土ei aee ? o D?o ?o ? ?2? o |)end ifend ifif not isarray(exceldata) theninerr(e y?Y?e ?o D?o )end ifif isarray(sheetname_) thenifgetarraydim(exceldata)1inerr(e y?Y?e ?o D?o ?e y?Y?e ?i ?o ? eo |?a o ?)elseifgetarraydim(exceldata)2inerr(e y?Y? e ?o D?o ?
6、e y?Y? e ?i ?o ? eo |?a?t)end ifend subrem eu 3 e excelpublic function create()call checkdata()if not isnull(readpath_) thenexcelapp.workbooks.open(readpath_)elseend ifset excelbook = excelapp.activeworkbookset excelsheets = excelbook.worksheetsif createtype_ = 2 thendim ih_for ih_ = 0 to ubound(exc
7、eldata)call setsheets(exceldata(ih_), ih_)nextexcelbook.saveas savepath_usedtime_ = formatnumber(timer - usedtime_)*1000, 3) exit functionend ifif isarray(sheetname_) thendim ik_for ik_ = 0 to ubound(exceldata)call createsheets(exceldata(ik_), ik_)nextelsecall createsheets(exceldata, -1)end ifexcelb
8、ook.saveas savepath_ usedtime_ = formatnumber(timer - usedtime_)*1000, 3) end functionprivate sub createsheets(byval data_, dataid_)dim spreadsheetdim tempsheettitledim temptitlefirstlineif dataid_-1 thenif dataid_ excelsheets.count - 1 thenexcelsheets.add()set spreadsheet = excelbook.sheets(1)elses
9、et spreadsheet = excelbook.sheets(dataid_ + 1)end ifif isarray(sheettitle_) thentempsheettitle = sheettitle_(dataid_)elsetempsheettitle = end iftemptitlefirstline = titlefirstline(dataid_) = sheetname_(dataid_)elseset spreadsheet = excelbook.sheets(1) = sheetname_ tem
10、psheettitle = sheettitle_ temptitlefirstline = titlefirstline end if dim line_ : line_ = 1 dim rownum_ : rownum_ = ubound(data_, 1) + 1 dim lastcols_ if tempsheettitle thenspreadsheet.columns(1).shrinktofit=trueee ?e ? ?X ? eeo | i ? ?a6 D?(?a? i 2? ?lastcols_ = getcolname(ubound(data_, 2) + 1)with
11、spreadsheet.cells(1, 1) .value = tempsheettitlee e ?excel.font.bold = true .font.italic = false.font.size = 20 .=?d ?卩?x ? i ?ii ?a? x ? i ? o ?ii ?a? x ? i ?Dee ?卩 ?a? x ?o?i ? ee ?卩 ?a? x ? i ?.font.colorindex=2ee ?卩 ?a? x ?卩? e ? ? e ? eo ?2 e ?_ ?2?axe end withwith spreadsheet.range(a1:
12、& lastcols_ &1).merge o?2C ?a?(卩 ?a? oo ).i nterior.colori ndex = 1 ee ?卩 ?a? 3?e.horizontalalignment = 3 ?o?Dend withline_ = 2rownum_ = rownum_ + 1end ifdim irow_, icol_dim drow_, dcol_dim templastrange : templastrange = getcolname(ubound(data_,2)+1) & (rownum_)dim beginrow : beginrow = 1if tempshe
13、ettitle then beginrow = beginrow + 1if temptitlefirstline = true then beginrow = beginrow + 1if beginrow=1 thenwith spreadsheet.range(a1:& templastrange)ee ? i a? o?e.borders.linestyle = 1 .borderaround -4119, -4138 .numberformatlocal = ? .font.bold = false.font.italic = false.font.size = 10.shrinkt
14、ofit=trueend withelsewith spreadsheet.range(a1:& templastrange).borders.linestyle = 1.borderaround -4119, -4138 .shrinktofit=trueend withwith spreadsheet.range(a& beginrow &:& templastrange) .numberformatlocal = .font.bold = false .font.italic = false.font.size = 10end withend ifbeginrow&:&if tempti
15、tlefirstline = true then beginrow = 1 if tempsheettitle then beginrow = beginrow + 1with spreadsheet.range(a& getcolname(ubound(data_, 2)+1) & (beginrow) .numberformatlocal = .font.bold = true .font.italic = false .font.size = 12 .interior.colorindex = 37.horizontalalignment = 3 ?o ?D.font.colorinde
16、x=2end withend iffor irow_ = line_ to rownum_for icol_ = 1 to (ubound(data_, 2) + 1)dcol_ = icol_ - 1drow_iftempsheettitle then drow_ = irow_ - 2 else= irow_ - 1if not isnull(data_(drow_, dcol_) thenwith spreadsheet.cells(irow_, icol_).value = data_(drow_, dcol_)end withend if next nextset spreadshe
17、et = nothing end subrem 2a e ?Xe ?t e ? ?o ?- 2Xprivate function isobjinstalled(strclassstring)on error resume nextisobjinstalled = falseerr = 0dim xtestobjset xtestobj = server.createobject(strclassstring) if 0 = err then isobjinstalled = trueset xtestobj = nothingerr = 0end functionrem e ?卩? e yxe
18、 ? e yprivate function getarraydim(byval arr) getarraydim = null dim i_, tempif isarray(arr) thenfor i_ = 1 to 60on error resume nexttemp = ubound(arr, i_) if err.number 0 thengetarraydim = i_ - 1 err.clear exit functionend ifnext getarraydim = i_end ifend functionee ?X- ?ee?ee ?叮 3?3?ee ?+ ?ee ?+ei
19、 aee ?ie y?Yclass createexcel private createtype_ private savepath_ private readpath_ private authorstrremprivate versionstr rem private systemstrremprivate sheetname_remprivate sheettitle_ rem private exceldataremprivate excelbooke 1 o ? e ? eX DDe ? ?ei aprivate excelsheets private usedtime_ rem public titlefirstline rem private sub class_initialize() server.scripttimeout = 99999 usedtime_ = timersystemstr= lc00_createexcelserverauthorstr = surnfu surnfu126 31333716 versionstr= 1.0if not isobjinstalled(excel.application) the
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 防雷安全题库及答案解析
- 2025年教育科技行业教育科技创新发展分析研究报告及未来发展趋势预测
- 2025年健康管理行业智能医疗健康管理系统在健康促进和疾病预防中的应用研究报告及未来发展趋势预测
- 2025年医疗健康大数据治理与隐私保护研究报告及未来发展趋势预测
- 2025年文化娱乐行业区块链数字版权保护研究报告及未来发展趋势预测
- 我为什么喜欢音乐话题作文4篇
- 业务谈判策略及会议纪要模板
- 营销团队绩效考核标准模板激励团队
- 公司财务成本控制与预算管理模板
- 期货从业考试计算题专训及答案解析
- 2025年秋外研版(三起)(2024)小学英语三年级上册期中考试模拟试卷及答案
- 《2025年浙江公务员录用审计专业试卷(审计监督)》
- 厦门市总工会招聘工会专干和集体协商指导员笔试真题2024
- 地理环境保护与发展+课件-2025-2026学年八年级地理上学期(人教版2024)
- 建筑模型学生介绍
- 王源完整课件
- 2025年国家级检验检测机构资质认定评审员考试测试题及答案
- 2025年广西高考地理真题(解析版)
- 2025建筑施工企业安管人员考试(企业主要负责人A类)练习题及答案
- 2025年越南语专升本翻译专项试卷(含答案)
- 食品安全总监知识考试题及答案
评论
0/150
提交评论