![asp读取excel代码(举了四个excel不同实例应用)_第1页](http://file3.renrendoc.com/fileroot_temp3/2022-1/2/740c3fc6-7376-472b-b555-6e238615111b/740c3fc6-7376-472b-b555-6e238615111b1.gif)
![asp读取excel代码(举了四个excel不同实例应用)_第2页](http://file3.renrendoc.com/fileroot_temp3/2022-1/2/740c3fc6-7376-472b-b555-6e238615111b/740c3fc6-7376-472b-b555-6e238615111b2.gif)
![asp读取excel代码(举了四个excel不同实例应用)_第3页](http://file3.renrendoc.com/fileroot_temp3/2022-1/2/740c3fc6-7376-472b-b555-6e238615111b/740c3fc6-7376-472b-b555-6e238615111b3.gif)
![asp读取excel代码(举了四个excel不同实例应用)_第4页](http://file3.renrendoc.com/fileroot_temp3/2022-1/2/740c3fc6-7376-472b-b555-6e238615111b/740c3fc6-7376-472b-b555-6e238615111b4.gif)
![asp读取excel代码(举了四个excel不同实例应用)_第5页](http://file3.renrendoc.com/fileroot_temp3/2022-1/2/740c3fc6-7376-472b-b555-6e238615111b/740c3fc6-7376-472b-b555-6e238615111b5.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、asp读取excel代码(举了四个 excel不同实例应用)asp? a e ?excel ' ? ?(? u a ?excel2? i ?e a y o | o ?).txt37?3? e ?a?£?e - Y? ?,?. & 0 £ ?3?e ?e£?u ?' |? a - ?2? o u ?a a ?£ ?3? e ? e ? , £ ? i ? o u e ?e ?o D)o a ?£public property let createtype(byval val)if val <> 1 a
2、nd val <> 2 thencreatetype_ = 1 elsecreatetype_ = val end ifend propertypublic property let data(byval val)if not isarray(val) theninerr("± i e y?Ye 6 ?6 D?6 ')end ifexceldata = valend propertypublic property get savepath()savepath = savepath_end propertypublic property get usedt
3、ime()usedtime = usedtime_ end property publicpropertyletsheetname(byval val) if not isarray(val) then if val = "" theninerr("± i ?6 6 ?6 D?6end if titlefirstline = trueelse redim titlefirstline(ubound(val) dim ik_forik_ =0 to ubound(val)titlefirstline(ik_)=truenextend if sheetnam
4、e = valend propertypublicpropertyletsheettitle(byval val)if not isarray(val) then if val = "" thennerr(" ± i ± e i a6 6 ?6 D?6 ") end ifend if sheettitle_ = valend propertyrem ? i 2e e y?Yprivate sub checkdata()ifsavepath_ ="" thennerr("± £ '
5、; ??2? u ?a?")ifnot isarray(sheetname_)thenifsheetname_ = "" theninerr(" ± i ?2?u ?a?")end ifif createtype_ = 2 thenif not isarray(exceldata)thenend ifinerr(nEyYO0Ee' ii6£-i»dOBI' O0Ee n)end ifexit sub end ifif isarray(sheetname_) then if not isarray (
6、sheettitle_) thenif sheettitle_ <> theninerr (n±i±eiaEedAODi6£-i6e±iAu2 »500 i")end ifend ifif not isarray (exceldata) then inerr(H±iEyYd0EeODi6n)if isarray(sheetname_) then if getarraydim(exceldata)<>1thennerr(" ± i e y?Y?6 ?6 D?6 £ ?e y
7、?Y?e ?' i ? o ? ?e o |?a o ?") elseif getarraydim(exceldata)<>2thennerr(" ± i e y?Y?e ?6 D?6 £ ?e y?Y?e ?' i ? o ? ?e o |?a?t") end if end sub rem e u 3e excel public function create() call checkdata() if not isnull(readpath_) thenexcelapp.workbooks.open(readpa
8、th_) elseexcelapp.workbooks.addend ifsetexcelbookexcelapp.activeworkbook setexcelsheetsexcelbook.worksheetsif createtype_ = 2 then dim ih_forih_ =0 toubound(exceldata) call setsheets(exceldata(ih_), ih_)nextexcelbook.saveas savepath_ usedtime_ formatnumber(timer usedtime_)*1000, 3) exit function end
9、 ifif isarray(sheetname_) thendim ikforubound(exceldata)iktocall createsheets(exceldata(ik_), ik_) next else call createsheets(exceldata, -1) end ifexcelbook.saveas savepath_usedtime_=formatnumber(timer-usedtime_)*1000, 3) end function private sub createsheets(byval data_, dataid_)dim spreadsheetdim
10、 tempsheettitledim temptitlefirstlineif dataid_<>-1 then ifdataid_>excelsheets.count - 1 thenexcelsheets.add()setspreadsheetexcelbook.sheets(l)elsesetspreadsheetexcelbook.sheets(dataid_ + 1)end ififisarray(sheettitle_)thentempsheettitle sheettitle_(dataid_)else tempsheettitle =""e
11、nd iftemptitlefirstline titlefirstline(dataid_) sheetname_(dataid_) elsesetspreadsheetexcelbook.sheets(l)sheetname_tempsheettitlesheettitle_temptitlefirstlinetitlefirstlineend ifdim line_ : line_ = 1dim rownum_ : rownum_ubound(data_, 1) + 1dim lastcols_if tempsheettit
12、le <> "" thenspreadsheet.columns(1).shrinktofio D?Gi ¥t=truee e ?, e ? ?X?- e e o | ± i ? 以 ¥ ?a ? i 2?±?£?lastcols_getcolname(ubound(data_, 2) + 1)with spreadsheet.cells(1,1).valuetempsheettitle;usijuu6!|e|e;uozuoq"c V 。乙£ 不乙乙q X 66 ? 5 J = X9pUU0|
13、00J0U9;Ur,(Q 9 CiC X d )666 X 71 0 乙乙。 sBjsiju"(J愚-s|oo;se|i.e.JsBuejjssqspesjds!mq;i/v pus6 5 X。?乙乙乙丁 _9 566 CCCJC CCC CXCCCCC 天石乙乙 W 3=X9pUU0|00;U0;|,16 I 6X6666 X 66,Z I6d.=9eu ;uoj-606X6666天寸乙乙Z 03=9ZIS;U0J-+GCCC I 6X6666 X E3S|EJ =例网UOJ6 66 16X666 X 引am; =pioqjuoj"6 I 6X6 6 P I + 190X
14、966 W V.end withline = 2 rownum_ = rownum_ + 1end ifdim irow_, icol_dim drow_, dcol_dimtemplastrange2)+1)&templastrange getcolname(ubound(data_, (rownum_)dim beginrow : beginrow = 1 if tempsheettitle <> "" then beginrow = beginrow + 1if temptitlefirstline = true then beginrow = b
15、eginrow + 1if beginrow=1 then withspreadsheet.range("a1:"& templastrange).borders.linestyle = 1.borderaround-4138 ' e e ? i a? o-4119,.numberformatlocal"" '? ± ? e ?.font.bold = false.font.italic = false.font.size = 10.shrinktofit=trueend withelsewithspreadsheet.
16、range("a1:"&templastrange).borders.linestyle = 1.borderaround-4119,-4138.shrinktofit=trueend with withspreadsheet.range("a"&beginrow&":"& templastrange).numberformatlocal"".font.bold = false.font.italic = false .font.size = 10 end with end ifif
17、 temptitlefirstline = truethenbeginrow = 1iftempsheettitle <> "then beginrow = beginrow + 1withspreadsheet.range("a"&beginrow&":"& getcolname(ubound(data_, 2)+1) & (beginrow) .numberformatlocal"" .font.bold = true .font.italic = false.font.siz
18、e = 12 .interior.colorindex37 .horizontalalignment3 '? o ?D.font.colorindex=2 end withend iffor irow_ = line_ to rownum_foricol_ =1 to(ubound(data_, 2) + 1) dcol_ = icol_ - 1 iftempsheettitle <> ""then drow_ = irow_ - 2 else drow_ = row_ - 1ifnotsnull(data_(drow_, dcol_) thenwith
19、spreadsheet.cells(irow_, icol_) .valuedata_(drow_, dcol_)end withend if next next set spreadsheet = nothing end subrem 2a e ?X e ?t e ? ? o ?- ° 2X°privatefunctionsobjinstalled(strclassstring) on error resume next isobjinstalled = false err = 0 dim xtestobj setxtestobjserver.createobject(s
20、trclassstring )if 0 = err then isobjinstalled =trueset xtestobj = nothing err = 0end functionrem 6 ? ?6 yX 6 ?6 yprivatefunctiongetarraydim(byval arr) getarraydim = null dim i_, temp if isarray(arr) then for i_ = 1 to 60 on error resume next temp = ubound(arr, i_) iferr.number <> 0 thengetarra
21、ydim= i_ - 1err.clear exit functionend ifnextgetarraydim = i_end ifend functionclass createexcelprivate createtype_ private savepath_ private readpath_private authorstr reme e ?X + ?private versionstr reme e ?° ?士?private systemstr reme e ? ti i 3?3?private sheetname_ rem e e ?± i ?private
22、 sheettitle_ reme e ?± e i aprivate exceldata reme e ?± i e y?Yprivate excelapp remexcel.applicationprivate excelbookprivate excelsheetsprivate usedtime_ reme16?ti?e±?public titlefirstline reme X DD6 ? - ?± e i aprivate sub class_initialize() server.scripttimeout = 99999usedtime_ = timer systemstr "lc00_createexcelserver" authorstr 'surnfu surnfu 31333716” versionstr "1.0"ifnotsobjinstalled("excel.application
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025标准版个人购房合同书
- 2025合伙买车合同
- 2024-2025学年新教材高中生物 第二章 基因和染色体的关系 微专题四 伴性遗传的解题方法说课稿 新人教版必修第二册
- 预制楼板施工方案
- 肇庆钢板桩支护施工方案
- 别墅电梯出售合同范例
- 2023九年级数学下册 第二十九章 投影与视图29.1 投影第2课时 正投影说课稿 (新版)新人教版001
- 2024年四年级英语上册 Unit 3 Let's Go Lesson 15 In the City说课稿 冀教版(三起)
- 自然补偿管道施工方案
- 2024年四年级英语上册 Unit 1 My classroom The fifth period(第五课时)说课稿 人教PEP
- 陕西省2024年中考语文真题试卷【附答案】
- 河南省郑州市二七区2023-2024学年七年级下学期期末考试语文试题
- 中国历代政治得失-课件
- 燃气经营安全重大隐患判定标准课件
- 课件:森林的基本概念
- JB-T 8532-2023 脉冲喷吹类袋式除尘器
- 安全员继续教育考试题库1000道附参考答案(完整版)
- 专题16.7 二次根式章末八大题型总结(拔尖篇)-八年级数学下册(人教版)(解析版)
- 如何提高调查研究能力
- 电网两票培训课件
- 改革开放教育援藏的创新及其成效
评论
0/150
提交评论