![asp讀取excel代碼(舉了四個(gè)excel不同實(shí)例應(yīng)用)_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/14/39c96a0c-b65f-4e0a-a7bb-109dd77d478d/39c96a0c-b65f-4e0a-a7bb-109dd77d478d1.gif)
![asp讀取excel代碼(舉了四個(gè)excel不同實(shí)例應(yīng)用)_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/14/39c96a0c-b65f-4e0a-a7bb-109dd77d478d/39c96a0c-b65f-4e0a-a7bb-109dd77d478d2.gif)
![asp讀取excel代碼(舉了四個(gè)excel不同實(shí)例應(yīng)用)_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/14/39c96a0c-b65f-4e0a-a7bb-109dd77d478d/39c96a0c-b65f-4e0a-a7bb-109dd77d478d3.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度物流包裝貨物運(yùn)輸合同范本
- 2025年度綠色交通工程勞務(wù)內(nèi)部承包服務(wù)合同
- 二零二五年度老舊小區(qū)改造物業(yè)管理協(xié)議3篇
- 新冠病毒專項(xiàng)健康教育
- 生態(tài)優(yōu)先技術(shù)為基-現(xiàn)代技術(shù)下的小鎮(zhèn)可持續(xù)發(fā)展策略
- 甲基四氫苯酐產(chǎn)品市場(chǎng)現(xiàn)狀及趨勢(shì)分析
- 未來(lái)生活場(chǎng)景下的現(xiàn)代住宅設(shè)計(jì)策略研究
- 電動(dòng)自卸車在公共事業(yè)中的運(yùn)營(yíng)成本研究
- 現(xiàn)代醫(yī)療物流體系的技術(shù)與服務(wù)創(chuàng)新
- 2025年龍巖道路運(yùn)輸從業(yè)人員從業(yè)資格考試
- 國(guó)庫(kù)集中支付培訓(xùn)班資料-國(guó)庫(kù)集中支付制度及業(yè)務(wù)操作教學(xué)課件
- 詩(shī)詞寫(xiě)作入門課件
- 2023年上海青浦區(qū)區(qū)管企業(yè)統(tǒng)一招考聘用筆試題庫(kù)含答案解析
- 2023版押品考試題庫(kù)必考點(diǎn)含答案
- 植物之歌觀后感
- 空氣能熱泵安裝示意圖
- 建筑工程施工質(zhì)量驗(yàn)收規(guī)范檢驗(yàn)批填寫(xiě)全套表格示范填寫(xiě)與說(shuō)明
- 2020年中秋國(guó)慶假日文化旅游市場(chǎng)安全生產(chǎn)檢查表
- 昆明天大礦業(yè)有限公司尋甸縣金源磷礦老廠箐-小凹子礦段(擬設(shè))采礦權(quán)出讓收益評(píng)估報(bào)告
- 心有榜樣行有力量 -從冬奧冠軍徐夢(mèng)桃身上感受青春奮斗初中主題班會(huì)
- 七年級(jí)英語(yǔ)下冊(cè)閱讀理解10篇
評(píng)論
0/150
提交評(píng)論