Read text file and show in table vbscript

前端 未结 2 489
攒了一身酷
攒了一身酷 2021-01-14 17:27

I have a text file with following structure :-

C:\\Users\\abc\\Desktop\\New Folder\\sample.txt
AccountName->AbcPos
AccountName->dblLayer
queryAccount-         


        
2条回答
  •  孤街浪徒
    2021-01-14 17:56

    My Implementation is like :-

    Set mytable=document.CreateElement("table")
    set thead = document.createElement("thead")
    set tr=document.createElement("tr")
    set th1=document.createElement("th")
    
    th1.setattribute "colSpan","4" 
    tr.appendChild th1
    thead.appendChild tr
    set tr2= document.createElement("tr")
    set th1= document.createElement("th")   
    set th2= document.createElement("th")
    set th3= document.createElement("th")
    set th4= document.createElement("th")
    set th5= document.createElement("th")
    th1.innerText="AccountName1"
    th2.innerText="AccoutnName2"
    th3.innerText="QueryAccount"
    th4.innerText="QueryName"
    th5.innerText="Path/Location"
    tr2.appendChild th1
    tr2.appendChild th2
    tr2.appendChild th3
    tr2.appendChild th4
    tr2.appendChild th5
    thead.appendChild tr2
    mytable.appendChild thead
    
    .......................
    .......................
    For Each thing in Fls
    ......................
    ........................
    
    set td1 = document.createElement("td")
    set td2 = document.createElement("td")
    set td3 = document.createElement("td")
    set td4 = document.createElement("td")
    set td5 = document.createElement("td")
    
    if condition
    
    set tr3=document.createElement("tr")
    td1.innerText=nodeinfo(0)
    td2.innerText=nodeinfo(1)
    td3.innerText=nodeinfo(2)
    td4.innerText=node.text
    td5.innerHtml="" & thing.Path &""
    
    tr3.appendChild td1
    tr3.appendChild td2
    tr3.appendChild td3
    tr3.appendChild td4
    tr3.appendChild td5
    tbod.appendChild tr3
    elseif i=2 then
    set tr3=document.createElement("tr")
    td1.innerText="--"
    td2.innerText=nodeinfo(0)
    td3.innerText=nodeinfo(1)
    td4.innerText=node.text
    td5.innerHtml="" & thing.Path &""
    tr3.appendChild td1
    tr3.appendChild td2
    tr3.appendChild td3
    tr3.appendChild td4
    tr3.appendChild td5
    tbod.appendChild tr3
    elseif i=1 then
    set tr3=document.createElement("tr")
    td1.innerText="--"
    td2.innerText="--"
    td3.innerText=nodeinfo(0)
    td4.innerText=node.text
    td5.innerHtml="" & thing.Path &""
    tr3.appendChild td1
    tr3.appendChild td2
    tr3.appendChild td3
    tr3.appendChild td4
    tr3.appendChild td5
    tbod.appendChild tr3
    

提交回复
热议问题