版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度新能源汽車動力電池回收利用合同范本4篇
- 2024食用菌種植基地環(huán)境保護與生態(tài)修復(fù)合同3篇
- 2024版美容院產(chǎn)品購銷合同
- 2025年度商業(yè)地產(chǎn)項目租賃收益分成合同范本4篇
- 編制加油站生產(chǎn)建設(shè)項目可行性研究報告編制說明
- 2025年綠色建筑裝修垃圾清運及節(jié)能減排合同2篇
- 2025年度個人樓房房買賣合同標(biāo)準(zhǔn)范本下載4篇
- 2025年社區(qū)商業(yè)綜合體商鋪租賃管理協(xié)議3篇
- 2025年版影視作品版權(quán)轉(zhuǎn)讓合同范本3篇
- 2025年度個人股東股權(quán)轉(zhuǎn)讓協(xié)議范本全面規(guī)范股權(quán)轉(zhuǎn)讓手續(xù)2篇
- 高考全國Ⅲ卷語文真題含答案
- 10kV架空線路專項施工方案
- OGSM戰(zhàn)略規(guī)劃框架:實現(xiàn)企業(yè)目標(biāo)的系統(tǒng)化方法論
- 遼寧省大連市中山區(qū)2023-2024學(xué)年七年級下學(xué)期期末數(shù)學(xué)試題
- 2023年版《安寧療護實踐指南(試行)》解讀課件
- 2024年新課標(biāo)高考化學(xué)試卷(適用黑龍江、遼寧、吉林地區(qū) 真題+答案)
- AQ6111-2023個體防護裝備安全管理規(guī)范
- 鈷酸鋰-安全技術(shù)說明書MSDS
- 江蘇省“大唐杯”全國大學(xué)生新一代信息通信技術(shù)大賽省賽題庫(含答案)
- (正式版)JBT 9229-2024 剪叉式升降工作平臺
- 如何做好談話筆錄
評論
0/150
提交評論