Results 1 to 9 of 9

Thread: Crystal Report Viewer in ASP.NET Problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Crystal Report Viewer in ASP.NET Problem

    Dear friends,

    I have made a report in .NET environment by crystal report. I have loaded it in a web form with a crystal report viewer.

    It is working good. But when I print the report it prints Report Name and Page No on the top of the paper and the report url on the bottom of the paper. I don't want to view these things on my report print out.

    Can anyone help me to do this.

    Best Regards,

    -Rajib

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Crystal Report Viewer in ASP.NET Problem

    Printing directly from the web page?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Crystal Report Viewer in ASP.NET Problem

    Thank u mendhak for ur response.

    Yes. I am printing it directly from web page. But I don't want to print those unnecessary things that I have already mentioned.

    -Rajib

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Crystal Report Viewer in ASP.NET Problem

    When printing from a webpage, those details WILL show up. If you print using CR's features, it will be printed without those details as CR uses different formats (PDFS,XLS) or an ActiveX Control to do the printing.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Crystal Report Viewer in ASP.NET Problem

    Ok, thats good. But I don't know how CR's features can be used to print.
    Please Help me in this case. I never used CR. I have always printed from page.

    Rajib

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Crystal Report Viewer in ASP.NET Problem

    Does your CR report have any export functionality? Can it export to PDF/XLS etc?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Crystal Report Viewer in ASP.NET Problem

    Actually I don't know how Crystal report can be exported to PDF format.

    --Rajib

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Crystal Report Viewer in ASP.NET Problem

    Please Response.

    I am waiting for u..

    -Rajib

  9. #9
    Junior Member
    Join Date
    Nov 2005
    Location
    Phoenix
    Posts
    24

    Re: Crystal Report Viewer in ASP.NET Problem

    I've done something like this before:


    VB Code:
    1. Dim rptFiveDay As New FiveDayNotice
    2. SQL = "EXEC sp_rptFiveDayNotice " & Session("FormNo")
    3. adapter = New SqlDataAdapter(SQL, Ado.DataConnection)
    4. adapter.Fill(ds, "FiveDayNotice")
    5. rptFiveDay.SetDataSource(ds)
    6. ExportData(rptFiveDay) 'Pass report to PDF

    VB Code:
    1. Public Sub ExportData(ByRef oRpt As Object)
    2.         Dim fs As IO.FileStream
    3.         Dim FileSize As Long
    4.         Dim oDest As New CrystalDecisions.Shared.DiskFileDestinationOptions
    5.         Dim ExportFileName As String = System.IO.Path.GetTempPath & Environment.TickCount.ToString & ".pdf"
    6.  
    7.         oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
    8.         oRpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
    9.         oDest.DiskFileName = ExportFileName
    10.         oRpt.ExportOptions.DestinationOptions = oDest
    11.         oRpt.Export()
    12.  
    13.         Response.Clear()
    14.         Response.Buffer = True
    15.         Response.AddHeader("Content-Type", "application/pdf")
    16.         fs = New IO.FileStream(ExportFileName, IO.FileMode.Open)
    17.         FileSize = fs.Length
    18.         Dim bBuffer(CInt(FileSize)) As Byte
    19.         fs.Read(bBuffer, 0, CInt(FileSize))
    20.         fs.Close()
    21.         Response.BinaryWrite(bBuffer)
    22.         Response.Flush()
    23.         Response.Close()
    24.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width