#Region "ExporttoPDF"
    Public Sub ExportToPDF2(ByVal strRptName As String)
        Dim strParam As String = ""
        Dim strPath As String = Application.StartupPath
        Dim objFS As Object
        Dim strPDF As Boolean = True
        Dim strDt_Fr As String = ""
        Dim strDt_To As String = ""
        Dim strEmployee_CD As String = ""
        Dim strNewName As String = ""
        Dim strOriginal, strOrignalPath, strNewRootName, strPDFName As String
        Dim strUniqueSuffix As String
        Dim strFormula As String
        If InStr(strPath, "bin", CompareMethod.Text) > 0 Then
            strRptPath = strPath.Substring(0, InStr(strPath, "bin", CompareMethod.Text) - 1)
            strRptPath = strPath
        End If
        If strRptPath.EndsWith("\") Then
            strRptPath = strRptPath & "\"
        End If
        Const ForReading = 1, ForWriting = 2, ForAppending = 8
        strOriginal = strRptPath
        objFS = CreateObject("Scripting.FileSystemObject")  ' Creating the instance of the FileSystem object form the scripting object.
        strRptPath += "Reports\PDF"
        Dim f, f1, fc, s
        f = objFS.GetFolder(strRptPath)
        fc = f.Files
        Dim p() As System.Diagnostics.Process = Process.GetProcesses(Dns.GetHostName)
        Dim i As Integer
        For i = 0 To p.Length - 1
            If p(i).ProcessName.Trim = "AcroRd32" Then
                Exit For
            End If
        For Each f1 In fc
            If objFS.FileExists(strRptPath & "\" & f1.name) Then
                objFS.DeleteFile(strRptPath & "\" & f1.name, True)
            End If
        strUniqueSuffix = "RptTest001" & Hour(Now) & Minute(Now) & Second(Now)

        strOrignalPath = strOriginal & "Reports\" & strRptName
        'strParam = "EMPCODE=" & strEmployee_CD & "" & "^^" & "FROM_DT=" & strDt_Fr & "" & "^^" & "TO_DT=" & strDt_To & ""
        'strParam = "FROM_DT=" & strDt_Fr & "" & "^^" & "TO_DT=" & strDt_To & "" & "^^" & "EMPCODE=" & strEmployee_CD & "" & "^^" & "FIN_YR=" & fin_yr & ""
        'strParam = "FROM_DT=" & strDt_Fr & "" & "^^" & "TO_DT=" & strDt_To & "" & "^^" & "EMPCODE ='1'" '& strEmployee_CD & ""
        If objFS.FileExists(strOrignalPath) Then
            strNewRootName = "Reports\PDF\" & strUniqueSuffix
            strNewName = strOriginal & strNewRootName & ".rpt"
            objFS.CopyFile(strOrignalPath, strNewName, True)
        End If
        Dim oPDFFile
        Dim bFileConverted
        oPDFFile = CreateObject("RPTToPDF.ExportToPDF")
        bFileConverted = oPDFFile.PopulateRPT(strOriginal & strNewRootName, strNewName, strParam, strFormula)

        If objFS.FileExists(strNewName) Then
            objFS.DeleteFile(strNewName, True)
        End If
        strPDFName = strOriginal & strNewRootName & ".pdf"
            If bFileConverted Then
            End If
        Catch ex As Exception
        End Try
    End Sub
#End Region

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet

What is the best way to spend time with your love

What is the best way to spend time with your love.. wht u think frnds...
No answer selected. Please try again.
Please select either existing option or enter your own, however not both.
Please select minimum 0 answer(s) and maximum 6 answer(s).
[{"id":"20665","title":"Movie","votes":"19","type":"x","order":"0","pct":18.45,"resources":[]},{"id":"20666","title":"party","votes":"7","type":"x","order":"0","pct":6.8,"resources":[]},{"id":"20667","title":"Shopping","votes":"8","type":"x","order":"0","pct":7.77,"resources":[]},{"id":"20668","title":"Dinner","votes":"20","type":"x","order":"0","pct":19.42,"resources":[]},{"id":"20669","title":"Long Drive","votes":"34","type":"x","order":"0","pct":33.01,"resources":[]},{"id":"20670","title":"Other","votes":"15","type":"x","order":"0","pct":14.56,"resources":[]}] ["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"] ["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"] 350
bottom 200
No married couple wants to end up getting divorced. It is not like they have planned for it. They try to put up with their partners for as long as they
Due to our modern lifestyle, we feel that digestion related disorders are a common problem. Thus, we neither give importance to them nor seek any help
The bond of marriage brings the two people together. Initially, everything may seem okay and both of them slowly start discovering each other in the journey.
Your online reputation is important You should know that it takes decades to make your reputation but to ruin it you need just couple of minutes and this
Basics of Cookies is Asp.Net Through this article you are able to know about the following points:1> What are the cookies?2> How to write and read cookies
  Introduction A Web server hosts information in the form of HTML files. The Web server is usually passive and merely acts as an efficient interface
Best language to learn .NET language is the best thing to learn. It has somewhat similar syntax as java and it’s a Microsoft Technology moreover it
If you decide to have an  opt-in list is not just a matter of sending your subscribers your promotional newsletters or catalogs. There are several things