I need to copy the content of a text file and paste it to a text area.  I 
tried the following methods:

1. Using Excel
Saving the text file as a parameter in one cell of an excel sheet and 
copying it to the data table at run time and pasting it to the text field. 
 Then it comes with the error message "DataTable.ImportSheet operation 
failed. Invalid file"

Following is the code I tried for this method.

Test file.
    
     tdata = fnGetExcelData("mData")
     Browser().Page().WebEdit().set tdata

Function fnGetExcelData(ColumnName)
    workbookPath="C:\Test\TestData.xls"
    sSheetName= Environment.Value("TestName")
    dim sColValue
    fnGetExcelData = "empty"
    DataTable.AddSheet("dtDataSheet")
    DataTable.ImportSheet,workbookPath,sSheetName,"dtDataSheet"  (It errors 
out here)
    DataTable.SetCurrentRow 1
    sColValue = DataTable.Value(ColumnName, "dtDataSheet")
     fnGetExcelData = sColValue
     DataTable.DeleteSheet("dtDataSheet")
 
End Function

2. Using Filesystem

Test file

     fileloc = "C:\Test\TestData\hData.txt"
     Set ofso = CreateObject("Scripting.FileSystemObject")
     Set ofile= ofso.OpenTextFile(fileloc, 1)
    Do while ofile.AtEndofStream <> True
tdata = ofile.ReadLine()
    Browser().Page().WebEdit().set tdata
    Loop
    
In this case the data gets overwritten by the next line and at the end only 
the last line of the file is there in the text area.

So how do I go about this to get the whole text file to get copied to the 
text area in the web page.

Thanks,
SunCat

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to