Micro Focus QTP (UFT) Forums
Storing to an Excel SS - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Storing to an Excel SS (/Thread-Storing-to-an-Excel-SS)



Storing to an Excel SS - mv8167 - 06-11-2011

I need help with this code. Currently, the View, Fax and Zip links are in one column in the import table, and my export is also get stuck on one line,

My wish is to have the column and row numbers in two seperate columns followed by a third colum that indicates the Link innertect name (ie... rig004, View, Fax, or Zip). The WebElement:WebTable is being selected that innertext equals [View] [Zip] [Fax]. I need the WebTable: Select All -> Link : View where the innerhtml, innertext or text equals View, Fax or Zip.

see the attachment for how my output looks now, and what I am am hoping for.

Any coding help?



Code:
Set objExcel = createobject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All")

RowCount = TableObj.RowCount
msgbox RowCount

For i = 1 to RowCount
ColCount = TableObj.ColumnCount(i)
'msgbox ColCount
For j = 1 to ColCount
ChildCount = TableObj.ChildItemCount(i, j, "Link")
If ChildCount > 0 Then
InnerHtml = TableObj.Object.rows(i-1).Cells(j-1).innerHTML
For k = 0 to ChildCount - 1
Set LinkObj = TableObj.ChildItem(i, j, "Link", k)
LinkName = LinkObj.GetROProperty("text")
objExcel.Cells(i, j).Value = TableObj.getcelldata(i,j)
Next
End If
Next
Next

thx everyone for looking ;-)


RE: Storing to an Excel SS - rajpes - 07-05-2011

Assuming you have created the column header (column,row,DocView)in an empty excel file,

Code:
Set objExcel = createobject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.Add
Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All")

RowCount = TableObj.RowCount
msgbox RowCount

For i = 1 to RowCount

[b]objExcel.Cells(i+1, 1).Value = i[/b]

ColCount = TableObj.ColumnCount(i)
'msgbox ColCount

For j = 1 to ColCount

[b]objExcel.Cells(i+1, 2).Value = j[/b]

ChildCount = TableObj.ChildItemCount(i, j, "Link")
If ChildCount > 0 Then
InnerHtml = TableObj.Object.rows(i-1).Cells(j-1).innerHTML
For k = 0 to ChildCount - 1
Set LinkObj = TableObj.ChildItem(i, j, "Link", k)
LinkName = LinkObj.GetROProperty("text")

[b]objExcel.Cells(i+1, 3).Value = TableObj.getcelldata(i,j)[/b]

Next
End If
Next
Next