最近看到壇子裡有人在問webtable控件擷取資料後,存儲和使用的便捷方式。
這裡我就獻醜寫一下我在這塊上的處理方式,我自己做了個簡單的頁面,來示範一些使用:
比如上面這個頁面,取資料不難,主要是直覺,是以我用的方法是用數組與字典結合的方式:
dim otable
set otable = browser("無标題文檔").page("無标題文檔").webtable("表格")
dim orow, ocol
orow = otable.rowcount
ocol = otable.columncount(1)
dim arrdata()
redim arrdata(orow)
dim i , j
for i = 1 to orow-1
set arrdata(i)=createobject("scripting.dictionary")
for j = 1 to ocol
arrdata(i).add trim(otable.getcelldata(1,j)) , otable.getcelldata(i+1,j)
next
print arrdata(3)("姓名")
print arrdata(9)("資料3")
下面的是使用和列印的效果。
ok,算是抛磚引玉吧。
最新内容請見作者的github頁:http://qaseven.github.io/