DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Bernie Guest

    Navigating from exported report form? - Spawn an new window from VB code??


    I have this routine that exports my crystal report into .pdf format
    so the user of my web application can print the report.

    I have had to disable all toolbars for security reasons, so when the
    user logs in, a new browser window is created without the toolbars.

    This is fine, but when i export the report using the code below there
    is no way to get back to the previous screen. - or is there??

    Can you help me please,

    I need to know how to spwan a new window from VB code so i can
    have two windows open, or can i create a button that can be viewed
    from with the report screen?


    Code:
    Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Handles btnExport.Click
    Comp.MyDataAdapter.Fill(MyDataSet)
    Dim FileName As String
    Dim crExportOptions As ExportOptions
    Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions()

    Dim ReportOptions As New Report1()
    ReportOptions.RecordSelectionFormula = ""
    Dim Formula As String
    Formula = "trim({tblItems.ItemName}) = " & Chr(34) & DropDownList1.SelectedItem.Value
    & Chr(34)
    Formula = Formula & " and trim({tblItems.ItemTime}) >='" & Text1.Value
    & "' And trim({tblItems.ItemTime}) <='" & Text2.Value & "'"
    ReportOptions.RecordSelectionFormula = Formula
    ReportOptions.SetDataSource(dstSSDEventList)
    Fname = "C:\temp\" & Session.SessionID.ToString & ".pdf"
    crDiskFileDestinationOptions.DiskFileName = Fname
    With ReportOptions.ExportOptions
    .DestinationOptions = crDiskFileDestinationOptions
    .ExportDestinationType = ExportDestinationType.DiskFile
    .ExportFormatType = ExportFormatType.PortableDocFormat
    End With
    ReportOptions.Export()
    Response.ClearContent()
    Response.ClearHeaders()
    Response.ContentType = "application/pdf"
    Response.WriteFile(Fname)
    Response.Flush()
    Response.Close()
    System.IO.File.Delete(Fname)
    End Sub


    thanks in advance,
    Bernie


  2. #2
    Robert Guest

    Re: Navigating from exported report form? - Spawn an new window from VB code??


    If the user right clicks on the report they should get a menu that has a
    "back" option. That's one option

    I did a similar project 1/2 year ago. I used a frameset. All the navigational
    links were on the left side and the input controls/data/reports were on the
    right side. Therefore, when the user was looking at a PDF report on the
    left frame. They could navigate out by clicking on a link in the left frame.
    If you are unfamiliar with Framesets give me an email and I can walk you
    through it.


    Robert

    "Bernie" <BernardRipley@Hotmail.com> wrote:
    >
    >I have this routine that exports my crystal report into .pdf format
    >so the user of my web application can print the report.
    >
    >I have had to disable all toolbars for security reasons, so when the
    >user logs in, a new browser window is created without the toolbars.
    >
    >This is fine, but when i export the report using the code below there
    >is no way to get back to the previous screen. - or is there??
    >
    >Can you help me please,
    >
    >I need to know how to spwan a new window from VB code so i can
    >have two windows open, or can i create a button that can be viewed
    >from with the report screen?
    >
    >
    >Code:
    >Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    >Handles btnExport.Click
    > Comp.MyDataAdapter.Fill(MyDataSet)
    > Dim FileName As String
    > Dim crExportOptions As ExportOptions
    > Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions()
    >
    > Dim ReportOptions As New Report1()
    > ReportOptions.RecordSelectionFormula = ""
    > Dim Formula As String
    > Formula = "trim({tblItems.ItemName}) = " & Chr(34) & DropDownList1.SelectedItem.Value
    >& Chr(34)
    > Formula = Formula & " and trim({tblItems.ItemTime}) >='" & Text1.Value
    >& "' And trim({tblItems.ItemTime}) <='" & Text2.Value & "'"
    > ReportOptions.RecordSelectionFormula = Formula
    > ReportOptions.SetDataSource(dstSSDEventList)
    > Fname = "C:\temp\" & Session.SessionID.ToString & ".pdf"
    > crDiskFileDestinationOptions.DiskFileName = Fname
    > With ReportOptions.ExportOptions
    > .DestinationOptions = crDiskFileDestinationOptions
    > .ExportDestinationType = ExportDestinationType.DiskFile
    > .ExportFormatType = ExportFormatType.PortableDocFormat
    > End With
    > ReportOptions.Export()
    > Response.ClearContent()
    > Response.ClearHeaders()
    > Response.ContentType = "application/pdf"
    > Response.WriteFile(Fname)
    > Response.Flush()
    > Response.Close()
    > System.IO.File.Delete(Fname)
    >End Sub
    >
    >
    >thanks in advance,
    >Bernie
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links