QTP输出结果到文本中并对齐

Dim fileSystemObj,fileSpec,logFile
Set fileSystemObj=createobject("Scripting.filesystemobject")
fileSpec="d:\"&"计算器测试报告"&".txt"
set logFile=fileSystemObj.OpenTextFile(fileSpec,8,true)


logFile.WriteLine("查询结果共:10条")
logFile.WriteLine("注册号"+"              "+"企业名称"+"                                "+"企业负责人"+"          "+"企业注册日期"+"           "+"匹配结果") 
rowcount = DataTable.GetSheet("Action1").GetRowCount
For i = 1 To rowcount Step 1
    zch=datatable("注册号",2)
    For j = 1 To 20-len(zch) Step 1
        zch=zch+" "
    Next
    qymc=datatable("企业名称",2)
    For j = 1 To 40-len(qymc)*2 Step 1
        qymc=qymc+" "
    Next
    qyfzr=datatable("企业负责人",2)
    For j = 1 To 20-len(qyfzr)*2 Step 1
        qyfzr=qyfzr+" "
    Next
    qydate=datatable("企业注册日期",2)
    For j = 1 To 20-len(qydate)*2 Step 1
        qydate=qydate+" "
    Next
    result=datatable("匹配结果",2)
    logFile.WriteLine(zch+qymc+qyfzr+qydate+result     )
    DataTable.GetSheet("Action1").SetNextRow
Next

你可能感兴趣的:(QTP对文本对齐)