2022年asp读取excel代码 .pdf
《2022年asp读取excel代码 .pdf》由会员分享,可在线阅读,更多相关《2022年asp读取excel代码 .pdf(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、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( y?Y ?D?) end if exceldata = val end property public property get savepath() savepath = savepath_ end proper
2、ty public property get usedtime() usedtime = usedtime_ end property public property let sheetname(byval val) if not isarray(val) then if val = then inerr( ? ?D?) end if titlefirstline = true else redim titlefirstline(ubound(val) dim ik_ for ik_ = 0 to ubound(val) titlefirstline(ik_) = true next end
3、if sheetname_ = val end property public property let sheettitle(byval val) if not isarray(val) then if val = then inerr( a ?D?) end if end if sheettitle_ = val 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 7 页 - - - - - - - - - end property rem ?2 y?Y private
4、sub checkdata() if savepath_ = then inerr( ?2?a?) if not isarray(sheetname_) then if sheetname_ = then inerr( ?2?a?) end if if createtype_ = 2 then if not isarray(exceldata) then inerr(y?Y? ? ?) end if exit sub end if if isarray(sheetname_) then if not isarray(sheettitle_) then if sheettitle_ then i
5、nerr( a ?D? ? ?2?|) end if end if if not isarray(exceldata) then inerr( y?Y?D?) end if if isarray(sheetname_) then if getarraydim(exceldata) 1 then inerr( y?Y?D? ?y?Y? ? ? |?a ?) else if getarraydim(exceldata) 2 then inerr( y?Y?D? ?y?Y? ? ? |?a?t) end if end sub rem 3excel public function create() c
6、all checkdata() if not isnull(readpath_) then excelapp.workbooks.open(readpath_) else excelapp.workbooks.add end if set excelbook = excelapp.activeworkbook set excelsheets = excelbook.worksheets 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 7 页 - - - - - - - -
7、 - 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(exc
8、eldata(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_ excel
9、sheets.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_) spreadsheet.name = sh
10、eetname_(dataid_) else set spreadsheet = excelbook.sheets(1) spreadsheet.name = sheetname_ tempsheettitle = sheettitle_ 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 7 页 - - - - - - - - - temptitlefirstline = titlefirstline end if dim line_ : line_ = 1 dim row
11、num_ : rownum_ = ubound(data_, 1) + 1 dim lastcols_ if tempsheettitle then spreadsheet.columns(1).shrinktofit=true ? ? | ?¥ ?a D?(¥ ?a?2? lastcols_ = getcolname(ubound(data_, 2) + 1) with spreadsheet.cells(1, 1) .value = tempsheettitle ?excel ? .font.bold = true ¥ ?a? ? .font.italic = false ¥ ?a?D .
12、font.size = 20 ?¥ ?a?o? .font.name=? ?¥ ?a? .font.colorindex=2 ?¥ ?a? ?2? ?2?a ? end with with spreadsheet.range(a1:& lastcols_ &1) .merge o?2¥ ?a?( ¥ ?a? ) .interior.colorindex = 1 ?¥ ?a?3? ? .horizontalalignment = 3 ?D end with line_ = 2 rownum_ = rownum_ + 1 end if dim irow_, icol_ dim drow_, dco
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年asp读取excel代码 2022 asp 读取 excel 代码
限制150内