Export Crystal Report

Here is my code to Exports crystal reports in PDF format but there is a problem i want to import and save file by specifying a location.
By default it Exports the file in to C drive
i.e i want to open dialog box and save file how to achieve this please help me.
Try
            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New  _
            DiskFileDestinationOptions()
            Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
            CrDiskFileDestinationOptions.DiskFileName = _
                                        "c:\crystalExport.pdf"
            CrExportOptions = rpt.ExportOptions
            With CrExportOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.PortableDocFormat
                .DestinationOptions = CrDiskFileDestinationOptions
                .FormatOptions = CrFormatTypeOptions
            End With
            rpt.Export()
            MessageBox.Show("PDF Report has been Generated Succussfully", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

You have two ways of exporting;
1) Use the viewer - you will get the dialog youare looking for
2) Use the report engine as you are doing - no dialog
If you need to use the engine, you will have to create your own dialog, retrieve the values entered by the user, then use the APIs you have in your code.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Similar Messages

  • Exporting Crystal Report to HTML is not working in Windows 7

    Hi Sir,
    I am trying to export Crystal Report to HTML format using VB.NET code. Functionality is working fine at Windows XP Environment (Save to Disk, Open an Application and Email Attachment). But the same functionality is not working at Windows 7 Environment (both 32-Bit as well as 64-Bit).
    Below is the code to Exporting Crystal Report to HTML in VB.NET.
    Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions
    Dim CrFormatTypeOptions          As New HTMLFormatOptions
    Dim vFormat As Integer
    Dim CrExportOptions As New ExportOptions
    Dim vRdReport As New ReportDocument
    Dim sfd As SaveFileDialog
    Dim vFileName As String = Nothing
    vRdReport = vRptSource
    sfd = New SaveFileDialog
    If Not (vRptPath = "") Then
        sfd.InitialDirectory = vRptPath
    End If
    sfd.Filter = "Webpage, Complete(.htm;.htm)|.htm|Web Archive, Single file(.mht)|.mht|Webpage, HTML only(.htm;.html)|.html"
    If sfd.ShowDialog = DialogResult.OK Then
        ' Set the disk file options.
         CrDiskFileDestinationOptions.DiskFileName = sfd.FileName.ToString()
    Else
         Return
    End If
    CrExportOptions = vRdReport.ExportOptions
    CrFormatTypeOptions.HTMLFileName = vFileName
    CrFormatTypeOptions.HTMLEnableSeparatedPages = True
    CrFormatTypeOptions.HTMLEnableSeparatedPages = True
    CrFormatTypeOptions.HTMLHasPageNavigator = True
    CrFormatTypeOptions.UsePageRange = True
    With CrExportOptions
                        .ExportDestinationType = ExportDestinationType.DiskFile
                        .ExportFormatType = ExportFormatType.HTML32
                        .DestinationOptions = CrDiskFileDestinationOptions.DiskFileName
                        .FormatOptions = CrFormatTypeOptions
    End With
    vRdReport.Export()
    Catch ex As Exception
            MsgBox(ex.ToString)
    End Try
    Code working fine at Windows XP, But it is not woking in Windows 7 environment.
    Please can anyone share your valuable thoughts or ideas reg. this.
    Thanks in Advance
    Deivanayaga Perumal D.

    user13509659 wrote:
    Run this code to reproduce the issue.Which issue?
    It looks like inheritance is broken in the component hierarchy for JFrame in Windows 7 JDK 1.6.0_23-b05. The only thing remotely related to inheritance in your code snippet is the WindowListener, which does little. See camickr's advice about built-in exit management.
    EDIT - using the post title as a clue, I realize you may be talking about the component hierarchy, and whether the contentPane's background is visible through the upper layers. Instead of guessing, I'd prefer you describe your "issue" accurately (observed vs expected behavior).
    Edited by: jduprez on Feb 10, 2011 1:01 PM

  • Help needed  while exporting crystal reports to HTML file format using java

    Help needed  while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
    html file of the report
    thanks

    the ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
    Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM

  • Logon Failed when exporting crystal report to PDF

    Hi, I am Teguh
    i want to ask about error when export crystal report to pdf
    error message
    CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed
    [LogOnException: Logon failed.]
       .I(String , EngineExceptionErrorID ) +506
       .D(Int16 , Int32 ) +537
       .C(Int16 ) +10
       CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +577
       CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) +141
       Falcon.CRTransferSlip.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\Falcon\CRTransferSlip.aspx.vb:77
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +750
    environment:
    OS : Windows server 2008 standard SP1
    IIS: Version 7.0
    SQL: Sql server 2000
    VS : Visual studio 2003
    i really confused with this error,
    please help me for this problem
    many thank's

    Hi Ludek
    Thank you for your response. I have installed SP3 and ProcMon and still the same result.
    I applied a filter on ProcMon to filter out items where the path contains 'export'.
    There are a few items where the result is 'NAME NOT FOUND' but I don't think it necessarly had anything to do with the barcode. These include items such as 'EXPORT\MailDestType','EXPORT\DisableExportLiveOfficeSupport'','EXPORT\ExportDirectory' to name a few.
    What drew my attention was the ACCESS DENIED result on specifically the EXPORT\PDF folders. The detail for these are  Desired Access : All access, however the very same entry appears a little futher on as a SUCCESS but this is detailed as Desired Access: Query Value.
    So in summary it looks something like this:
    User : Server\XXX
    Operation : RegOpenKey
    Path : HKU\.DEFAULT\Software\Business Objects\Suite 12.0\Crystal Reports\Export\Pdf
    Result : ACCESS DENIED
    Desired Access : All Access
    User : Server\XXX
    Operation : RegOpenKey
    Path : HKU\.DEFAULT\Software\Business Objects\Suite 12.0\Crystal Reports\Export\Pdf
    Result : SUCCESS
    Desired Access : Query Value
    There are a few other entries that follow this pattern that exists in other locations such as HKLM\Software...
    Could this 'ACCESS DENIED' be the problem? and If so how do I, and should I give user XXX this ALL Access its looking for.
    Regards
    Elroy

  • Error While Exporting Crystal Report in XLS

    Hi
    when i am exporting crystal report in PDF or MS-Word its working fine
    When i am going to export crystal report to Microsoft-Excel 97-2000 (XLS) i am encountering ....
    Error in File C:\WINNT\TEMP\{6A5FE727-7FDE-479F-A7D0-96EE33EF5A4F}.rpt: The request could not be submitted for background processing.  this error...
    Can anybudy plz have its solution??
    Edited by: vishal patil on Sep 29, 2008 3:21 PM

    Hi Visahal,
    Try to re-install the export excell dll files.  Go in Controll pannel Add and Remove ProgaramsClick on Crystal Reports Click on ChangeSelect Add/RemoveThen expend ExportSelect Excel export and click on ok to reinstall the excel export dlls.
    After re-installation try to export to excel.
    Thanks,
    Sastry

  • "The process cannot access the file ..." occurs when export crystal report

    We are using a web application developed in VS 2005, .NET 2.0 with the bundled Crystal Reports version 10.2.3600.0 running on a Windows 2003 Standard server with 4GB Ram and Dual CPU's. Periodically we are still receiving the following error in our production environment:
    InnerException:
    The process cannot access the file because it is being used by another process.
       at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
       at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
       at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType)
    This is occuring at the point on the code where the report is being exported to a PDF. Exporting the report to Excel does not appear to cause the error.
                    Stream outStream = report.ExportToStream(ExportFormatType.PortableDocFormat);
                    byte[] charStream = new byte[outStream.Length];
                    outStream.Read(charStream, 0, (int)outStream.Length);
                    if ((charStream != null) && (charStream.Length > 0))
                        HttpContext.Current.Response.ContentType = "application/pdf";
                        HttpContext.Current.Response.OutputStream.Write(charStream, 0, charStream.Length);
                        HttpContext.Current.Response.End();
                report.Close();
                report.Dispose();
                ds.Dispose();
                GC.Collect();
    Closing and disposing of the report and dataset (xsd) are followed by a call for garbage collection. We are unable to produce the error in our development environmennt and have not at this point been unable to pinpoint a problematic report. The development team members do have SP1 installed. The report limit has not been changed from the standard of 75 jobs.  Reviewed the following document, Re: "The process cannot access the file ..." occurs when export crystal report However this applies to VS 2008. Any suggestions to resolve the issue would be greatly appreciated.
    Thanks,
    Joe

    Good morning Joe
    For more details re. loading please see the following resources:
    [Crystal Reports 2008 Component Engine Scalability|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/7025839b-00d4-2b10-33b4-cf0aa9e08412?quicklink=index&overridelayout=true]
    [How Can I Optimize Scalability?|http://msdn.microsoft.com/en-us/library/ms225519.aspx]
    [Choosing the Right Business Objects SDK for Your Needs|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40bccdfd-88a6-2b10-1da1-c47a54b625a7]
    To answer your questions:
    Is it correct to presume that the physical number of CPU's is not factored into the CPL? So that a Server with 2 or more processors does not increase the 3 concurrent requests? Therefore 2 CPU's would not increase the CPL limit to 6 processes?
    - Server with 2 or more processors does not increase the 3 concurrent requests.
    What would be an alternate solution to this limit be, considering the report requests could increase significantly?
    - Only way around this would be to web farm the solution
    If only only 3 reports can be processed at the same time. If one or more of the reports currently processing is taking longer due to receiving large amounts of data, how does that affect the queue? And what is stored in the queue, data and/or the report? Is this something that could consume memory?
    - The report can take as much time as it needs. The result is that one license will not be released until the report is done. There is no data stored, just a pointer to the report. However queued apps will chew up memory, some times to the point of the server becoming unresponsive
    I have read in the documentation on this site, that the dataset sent to the engine is copied in memory during report construction. So if a large amount of data is requested for a report (as an example 10+ MB) Could enough users requesting reports drive the memory up because memory usage doubled due to the dataset?
    - Absolutely. See [Crystal Reports Guide to ADO.NET|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/401c4455-a31d-2b10-ae96-fa57af5aec20].
    Understanding the the CR DLL's are loaded on the first report request, do they get released at some point time due to inactivity or garbage collection? How much memory usage could be consumed when they load and stay resident?
    - No they do not. Not as long as the application is running.
    Ludek

  • Problems in exporting crystal report to word format

    Hi All,
    I am getting trouble in exporting crystal report to word formats.
    Here are my questions:
    1) The exported word file will have a text "R..950" added on top right hand corner, How to get rid of it?
    2) For those "Can Grow" fields, it can show multiple line data correctly in the viewer. However, the text box in exported word file will be too small to show all the content and lower half of the text is cut.
    Thanks and Regards,
    Cherry

    Hi Asha,
    Thanks for reply.
    The version of crystal report designer and viewer which I am using is version 11 Release 2.
    Besides, I guess it might relate to the format of report so I would like to tell you more.
    Font Face: Arial Unicode MS (in order to show chinese characters)
    Font Size: 9 pt
    For the text "R..950" issue, I just found that some people in the internet having the same issue and they suggested that may relate to the locate. In my case, the locate is Chinese (Hong Kong S.A.R.).
    If it is necessary, I may send you my report with sample for test.
    Regards,
    Cherry

  • Unable export crystal report XI to pdf on window server 2003 SP1

    I have a class asp function to export crystal report XI to pdf file, it is workable at winXP but when i copy it to window server 2003, it exported the file with zero length (file size is 0kb).
    when i try to open the zero length pdf file, it shows the file is already open or in use by another application.
    when i run my export function, i can see there is a new file created at the folder "C:\windows\Temp", when i try to open the tmp file, i get the message "The process cannot access the file because it is being used by another process", i can open the tmp file after i end the process "w3wp.exe network service", the data in the tmp file is exactly what i need to export to the pdf file.
    At the window server 2003, I have installed the Crystal Report XI developer edition,
    For the web application folder and the pdf export folder, Read, Write and Modify permission has been set for the following accounts:
    1. myServer\Administrators
    2. myServer\ASPNET
    3. myserver\IUSR_myserver
    4. myServer\IWAN_myserver
    5. Network Service
    6. System
    7. myServer\Users
    I think it is the permission problem, but how to set the right permission at the window server 2003 SP1? please advise. thanks

    Hello,
    It is a permission issue. When you export Crystal first tries to write the file to the local TEMP folder and then delete it to see if it has read/write permissions. If it fails to delete the file you need to give the TEMP folder on the WEB server permissions for your application. Check Microsofts WEB site on how to set permissions on shared folders for your ASP application.
    You may want to search in forums also, this looks familar.
    Thank you
    Don

  • Drill-down options on exported Crystal reports (PDF/HTML)

    Is it possible to drill-down on the exported crystal reports in PDF/HTML format?

    PDF format does not support drill-down. 
    PDF format supports bookmarking to specific locations in the document, but not something refined as drilling.
    Sincerely,
    Ted Ueda

  • Could not export Crystal report from SAP B1 to MS excel

    Hi Experts.
    Could not Export crystal report  which are created in .net crysta report to MS excel in SAP business one.
    Kindly give any solution.
    Thanks & Regards,
    Bhushan

    Hi,
    Crystal reports it self u can export data from MS excel .
    Regards,
    Siva

  • How to export crystal report to excel through progeam

    Hi,
    Can any help me how to export crystal report to excel through program(C#). I'm using VS2005.
    Also, the report should be in a pivot table format after exporting to the excel..please help me how to do this
    Thanks,
    Venky

    Hi Venkat,
    The link below provides the code C# in an ASP.NET codebehind file
    http://www.codeproject.com/KB/cs/Crystal_Report_Export.aspx
    http://aspalliance.com/478_Exporting_to_Excel_in_Crystal_Reports_NET__Perfect_Excel_Exports.2
    Regards,
    Abhijeet  T.

  • Layout Issue after exporting crystal report XI in pdf format

    Hi All,
    I have developed a crystal report in XI version. I have set my page layout properties in the report to be in landscape orientation and A2 size sheet with No Printer(optimize for screen display) option unchecked. The problem is when I export the report in pdf and open the report in pdf for printing, it takes the printer preference settings that are set to portrait and letter format. If I change my printer prefence settings to landscape, it works fine. But, I do not want to change my printer preference settings and want that the settings that I am giving in crystal report designer must be taken for printing purposes in pdf.
    I hope, I was able to put forward the question correctly without any confusion.
    Can someone please help me out to find a solution ?
    Thanks in advance.

    Hi Akshay
    Always quote the actual version of Crystal Reports you are working with. E.g.; CR IX is not quite enough and the best place to find the actual version is in the Help | About screen of the CR designer.
    By CR XI, you could mean CR 11.0.x, or CR 11.5.x. If you are using CR 11.0.x, update to CR 11.5 (also referred to as CR XI R2). See this blog on how to.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • No link to the local .avi files after exporting Crystal report as .pdf

    Hello all,
    The overall scenario is like-
    My application fires a query on SQL Server database and result of that query is stored in a Dataset. This dataset is set as a datasource to the Crystal report.  Now some, records (returned by the query) have .avi files(i.e. Event Videos which are stored on the local hard disk) associated with them. I have stored these .avi files in a specific path on local Hard disk say "C:/EventVideos/*.avi" .   I used a special format in these avi files name. (like - "EventVideo_1.avi" (This is for 1st event), "EventVideo_5.avi" (This is for 5th event)etc. to identify which avi is for which event. All events do not have avi files associated with them)
          Now, I take one Text Object in crystal report. Using it's Format editor created a formula for hyperlink as -
          "file:///c:/EventVideos/EventVideo_" + {DataTable1.EventID} + ".avi" .
    EventID is the field of dataset which has ID's (like 0, 1, 2,  3, 4 etc) of all resulted events. It is of a String data type.
         Now when I export, my report as .xls, .rtf, .doc, I can open the avi files. When I bring cursor on this Text Object, cursor get change to Hand and after click on it avi file start to play.
         But if I export it as .pdf, it does not contain the link for avi files. When I bring cursor on this Text Object , it does not change to Hand, and after click on it nothing happens. No video play.
    I stick to this problem. What should be done in this case?
    Appreciate your help.
    Thanks in advance.

    duplicate - please do not post multiple times

  • No link after exporting Crystal report as pdf file

    Hello,
              If my Crystal Report contain link to the .avi file saved on the local hard disk and if I export the Report as .pdf file, pdf file does not contain that link. Why?
    The overall scenario is like-
    My application fires a query on SQL Server database and result of that query is stored in a Dataset. This dataset is set as a datasource to the Crystal report.  Now some, records (returned by the query) have .avi files(i.e. Event Videos which are stored on the local hard disk) associated with them. I have stored these .avi files in a specific path on local Hard disk say "C:/EventVideos/*.avi" .   I used a special format in these avi files name. (like - "EventVideo_1.avi" (This is for 1st event), "EventVideo_5.avi" (This is for 5th event)etc. to identify which avi is for which event. All events do not have avi files associated with them)
          Now, I take one object in crystal report. Using it's Format editor created a formula for hyperlink as -
          "file:///c:/EventVideos/EventVideo_" + {DataTable1.EventID} + ".avi" .
    EventID is the field of dataset which has ID's (like 0, 1, 2,  3, 4 etc) of all resulted events. It is of a String data type.
         Now when I export, my report as .xls, .rtf, .doc, I can open the avi files. When I bring cursor on this object, cursor get change to Hand and after click on it avi file start to play.
         But if I export it as .pdf, it does not contain the link for avi files. When I bring cursor on this object, it does not change to Hand, and after click on it nothing happens. No video play.
    I stick to this problem.
    Appreciate your help.
    Thanks in advance.

    Taken from CR Help File:
    "PDF format is a page-based format. The exported documents are intended for printing and redistribution. PDF format will export both layout and formatting in a manner that is consistent with how the report looks on the Preview tab. PDF format embeds the TrueType fonts that appear in the document. (Non-TrueType fonts are not supported.) This export format does not support Microsoft font-linking technologyu2014which is used to provide support for some extended character sets such as Chinese HKCS. Therefore, the fonts used in the report must contain all of the required glyphs. These URI types are supported for hyperlinks: "http:", "https:" and "mailto:".
    Therefore your hyperlink is not working as u are using File type when cr only supports http https and mailto uri types

  • Cannot export crystal report in excel format from crystal report viewer

    This problem occurs on only one workstation.
    Open Advanced Reports > Enter workorder # > Click on 'workorder work(uninvoiced)' > Work order opens.
    Click on icon "Export report"
    Save as type: change to .xls
    Error: Crystal Report Windows Forms Viewer. Error in file
    SAP.......rpt:
    Error detected by export DLL:
    Export failed.

    Try adding c:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86 to your windows enviroment variable PATH then restart.

Maybe you are looking for