Knowledge Share

Knowledge is NOT Power IMPLEMENTATION of knowledge is Power!!!
 
HomePortalGalleryCalendarFAQRegisterUsergroupsLog in

Share | 
 

 Excel report code

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Posts : 142
Points : 410
Reputation : 0
Join date : 2007-12-29
Location : Chennai

PostSubject: Excel report code   Tue Jul 14, 2015 10:21 am

Public Class dynamicemailtemplate
        Dim oexcel As Object
        Dim oBook As Object
        Dim oSheet As Object
        Dim oSheet_status As Object
        Dim s As Object
        Dim starttime As String
        Dim sep As String = ":"
        Dim methodName As String
        Dim methodName1 As String
        Dim i As Integer = 3
        Dim j As Integer = 3
        Dim z As Integer = 3
        Dim hour1 As String
        Dim mini1 As String
        Dim second1 As String
        Dim hour2 As String
        Dim mini2 As String
        Dim second2 As String
        Dim str As String = ""
        Dim myTime As DateTime
        Dim myTime2 As String
        Dim method1 As String
        Dim jj As Integer
        Dim tsp As String
        Dim com As Integer = 0
        Dim pstp As Integer = 0
        Dim fstp As Integer = 0
        Dim rmstp As Integer
        Dim ll As Integer = 2
        Dim sttime As String
        Dim entime As String
        Dim tot_time As TimeSpan = TimeSpan.Parse("00:00:00")
        Dim y As Integer
        Dim tot_time2 As TimeSpan
        Dim tpass As Integer = 0
        Dim tfail As Integer = 0
        Dim f
        Dim a As String


        Public Function totaldatacount(ByRef r As Integer, ByRef datafile As String)
            Dim oExcel2 As Object
            Dim oBook2 As Object

            'oexcel.quit()
            ''''''''''''''Gets the total no of iterations from excel test data sheet'''''''''''''''''''''''''''''''''''''''''
            oExcel2 = CreateObject("Excel.Application")
            oBook2 = oExcel2.Workbooks.Open(datafile)
            r = oExcel2.Application.ActiveSheet.UsedRange.Rows.Count
            oBook2.close()
            Dim proc = Process.GetProcessesByName("QTAgent32.exe")

            Dim pListOfProcesses() As Process
            Dim pExcelProcess As System.Diagnostics.Process
            pListOfProcesses = Process.GetProcesses
            For Each pExcelProcess In pListOfProcesses
                If pExcelProcess.ProcessName.ToUpper = "EXCEL" Then
                    pExcelProcess.Kill()
                End If
            Next
            Return r
        End Function

        Public Function CountNumberOfTestMethods(ByRef countOfTestMethods As Integer, ByRef prjpath As String) As Integer

            For Each ty As Type In System.Reflection.Assembly.LoadFrom(prjpath).GetTypes
                For Each method As System.Reflection.MethodInfo In ty.GetMethods
                    For Each ca As System.Reflection.CustomAttributeData In method.GetCustomAttributesData
                        If ca.ToString() = "[Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]" Then
                            countOfTestMethods += 1
                            Return countOfTestMethods
                            Exit Function
                        End If
                    Next
                Next
            Next
            Return countOfTestMethods
        End Function

        Public Sub CreateExcel(ByRef filename As String, ByRef g As String, ByRef r As Integer)

            i = 3
            j = 3
            z = 3
            If g = 1 Then
                If File.Exists(filename) Then

                    File.Delete(filename)
                End If

                If Not File.Exists(filename) Then

                    oexcel = CreateObject("Excel.Application")
                    oBook = oexcel.Workbooks.add
                    oexcel.Worksheets(3).delete()
                    oexcel.Worksheets(2).delete()
                    For kk As Integer = 2 To (r - 1)
                        With oexcel
                            .Worksheets.Add(After:=.Worksheets(1))
                        End With
                    Next
                    oBook.SaveAs(filename)
                    oBook.close()
                End If
            End If

            oexcel = CreateObject("Excel.Application")
            oBook = oexcel.Workbooks.open(filename)
            s = Convert.ToInt32(g)

            If g <> " " Then
                oSheet = oBook.Worksheets(s)
                oSheet.name = "testdata" & s

            End If



            If g = 1 Then

                With oexcel
                    .Worksheets.Add(After:=.Worksheets(r - 1))
                End With

                oSheet_status = oBook.Worksheets(r)
                oSheet_status.name = "Test Execution Report"
            End If


        End Sub
Back to top Go down
http://knowledgeshare.forumotion.com
 
Excel report code
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Need Selenium Webdriver + Excel sheet examples
» reading from an excel report -appreciate any urgent response
» How to write in excel
» DataDriven from Excel in C# with NUnit
» how to data driven using excel in selenium rc

Permissions in this forum:You cannot reply to topics in this forum
Knowledge Share :: Testing :: Automation :: VSTS :: CODED UI-
Jump to: