Programatically Rename Exported Crystal Report File
Hi All,
In my VB.NET code, I am trying to rename the CrystalReportViewer1.Id so that when a user exports a file, it will be named with the name of the report plus a parameter that they ran the report on. When testing my results, I get "Value cannot be null. Parameter name: inputString" on my web page. My question is where should I be inserting the CrystalReportViewer1.Id code so that it can work and without the error message?
Thank you in advance,
Hello Antoine
I just played with that API last week. All I did is place it just before setting the report to the viewer:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim crReportDocument As New ReportDocument
crReportDocument.Load("C:\Crystal\formulas.rpt")
CrystalReportViewer1.ID = ("Formulas")
CrystalReportViewer1.ReportSource = crReportDocument
End Sub
Now, remeber this is only for web apps...
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
-
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
thanksthe 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 -
"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,
JoeGood 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 -
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 -
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 PMHi 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 -
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,
CherryHi 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. thanksHello,
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 -
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,
VenkyHi 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. -
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 SubYou 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] -
Help required in embedding flash file object into Crystal Report file.
Hello,
I use the default version of Crystal Report (i.e.'Crystal Report Basic For Visual Studio 2008 - version 10.5' ) which is the part of 'Visual Studio 2008', to create and display the Report. Further, as a requirement, I have to show 'Event Video' into the Report. But, as this default version of Crystal Report does not support Flash File, I uninstalled it and downloaded and installed the 30 days trial version of the Crystal Report (i.e. Crystal Report 2008 - version 12.0).
Then, I created a new Crystal Report File using 'Crystal Report 2008 Designer', embedded the video as a Flash File(i.e. SWF file) into it. Now, when I add this newly created Crystal Report File into my sample application, which is created using VS 2008, it does not shows the embedded video.
So, can anybody please tell me, how can I embed the Flash File into Crystal Report, so that it will be visible in the sample application?
I would like to appreciate your help and support.
Thanks,
-Yogesh.Symptom :
When embedding a pdf document into a Crystal Report, only the one page shows.
Reproducing the Issue
Environment:
Crystal Reports OLE object
Cause
An OLE object only displays the first page.
Resolution
Embed multiple objects, one for each page
Or
Use a hyperlink to the object instead
Hope this helps!
Regards,
Vinay -
RE: What's database field are used in crystal report file?
Hi all
Please help me a C# code that using Crystall Report API (Crystal Report XI- Develop license) to get the list of database fieldname that using in crystal Report file. (What's database field using in header section ,group section , detail section of report.....)
We looking forward to hearing from you
Thanks
SonHello Son,
please use this code below to get a list of used database fields in a report :
//File Name: CS_Get_report_data_out_inproc.sln
//Created: April 11, 2008
//Author ID: FLI
//Purpose: This C# .NET sample Windows application demonstrates
// how to retrieve report data and put the into a XML file
// using unmanaged RAS.
// Note this is available without a dedicated RAS with SP2 for XI R2
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.DataDefModel;
namespace CS_Get_report_data_out_inproc
public partial class Form1 : Form
// CR Declarations
ReportDocument boReportDocument;
ISCDReportClientDocument boReportClientDocument;
public Form1()
InitializeComponent();
//Create a new ReportDocument
boReportDocument = new ReportDocument();
// load the RPT file
boReportDocument.Load("..
ReportData.rpt");
// show in reportviewer
crystalReportViewer1.ReportSource = boReportDocument;
private void button1_Click(object sender, EventArgs e)
//Access the ReportClientDocument in the ReportDocument (EROM bridge)
boReportClientDocument = boReportDocument.ReportClientDocument;
// Retrieve the Rowset Controller
RowsetController boRowsetController = boReportClientDocument.RowsetController;
// Retrieve the metadata (column headers) - this allows you to only retrieve the data that is on the report.
RowsetMetaData boRowsetMetaData = new RowsetMetaData();
Fields boFields = boReportClientDocument.DataDefinition.ResultFields;
boRowsetMetaData.DataFields = boFields;
// Now print out the data in XML file
//(Note: This will print out the results of formulas too)
StreamWriter sw = new StreamWriter("C:
ReportData.xml", false);
sw.WriteLine("<?xml version='1.0' encoding='utf-8'?>");
sw.WriteLine("<ReportData>");
sw.WriteLine("<Reportheader>");
// Print out the titles
for (int i = 0; i < boFields.Count; i++)
String boFieldName = boFields<i>.Name;
sw.WriteLine("<ReportheaderDetail>" + boFieldName + "</ReportheaderDetail>");
sw.WriteLine("</Reportheader>");
//Create the cursor which lets us loop through the data
RowsetCursor boRowsetCursor = boRowsetController.CreateCursor(null, boRowsetMetaData, 1);
Record boRecord;
while (boRowsetCursor.IsEOF == false)
sw.WriteLine("<Customer>");
boRecord = boRowsetCursor.CurrentRecord;
for (int j = 0; j < boFields.Count; j++)
try
sw.WriteLine("<Detail>" + (String)boRecord[j].ToString() + "</Detail>");
catch (Exception err)
sw.WriteLine("<Error>" + err.Message + "</Error>");
sw.WriteLine("</Customer>");
boRowsetCursor.MoveNext();
sw.WriteLine("</ReportData>");
// CLose the file
sw.Close();
MessageBox.Show("XML File 'ReportData.xml' successfully created on C:"); -
Overwrite crystal report file name with new version but keep history
I am writing a Crystal Reports .NET SDK in C# code to upload a crystal report files from its destination to CMC folder on BO XI R2 Platform.
On "Upload Button" click_event, validate the two check boxes controls named "Keep History", and "Remove History". Once "Keep History" check box is selected, check If the SAME report file name exists in the same destination CMC folder, if Yes, overwrite it BUT Keep the History and all its associated objects like "recurring objects". If "Remove History" is selected, then remove the existing report and upload the new report file name.
Please provide me some codes on how to do this task. This is definitely a "WIN" - "WIN" effort and contribution to my Team Goals.
P.S. This is a similar scenario when you are uploading report on BO Enterprise R2 CMC.
When Uploading a new report to a folder but same report file name exists, the BO System will promt message "Report File Name" already exists. Do you want to Overwrite it?" If Yes, then system will overwrite the file but it will keep the history and recurring objects.
Any help would be greatly appreciated.
Thanks,
BienSuggest looking at [this|https://wiki.sdn.sap.com/wiki/display/BOBJ/NETBusinessObjectsEnterpriseSDKSamples] wiki for links to pertinent samples. Also, check out the [Developer Help File|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/WS_SDK/wssdk_server/default.htm]. Searching these forums for similar queries may also prove to be fruitful
Ludek -
Creating crystal report file dynamically.
Post Author: malcomstewart115
CA Forum: General
Hi, everybody.
I have one problem.
How to create crystal report file(*.rpt) in php dynamically.
I mean, I want to create the "*.rpt" file with php code.
Please help me. thanks everybody.Post Author: PWilkens
CA Forum: General
It sounds like you're defeating the power and purpose of Crystal Reports, or replace it with pure PHP (which I suppose could be done... but why?)
What exactly are you trying to do?
If you're trying to make certain parts of the report hide or reveal or change depending on variables settings in the PHP file, that's easy enough to accomplish by sending parameters with your PHP values into the report. But the dynamic actions really need to be done within the report itself, accomplished through ample use of the section and field settings provided within the Report Designer. -
Create crystal report file using JAVA
Can someone tell me how to a Create crystal report file using JAVA Programming
I want a very simple examplePlease help me. It's urgent.[http://catb.org/~esr/faqs/smart-questions.html#urgent]
Be back in an hour or two... -
View Crystal Report File from SDK
Hello All,
I want to View Crystal Report File (.rpt file) from SDK (using VB 6 )
I have already try following code on my Add On :
Public Sub RunCrystalReport()
Dim crlApp As New CRAXDDRT.Application
Dim crlRep As CRAXDDRT.Report
Set crlRep = crlApp.OpenReport("D:\ReportTest.rpt")
Dim CRAX2 As CrystalActiveXReportViewerLib12Ctl.CrystalActiveXReportViewer
Set CRAX2 = Form2.CRAX
CRAX2.ReportSource = crlRep
CRAX2.ViewReport
End Sub
But, nothing happen
Could some one help one for this ?
Thanks a lot
Regards,
Arie
SDK BeginnerAmazing Sir !!...
I could run my report through B1 SDK right now...
Many thanks to you Sir..
Just one more thing, The Horisontal and Vertivcal Scroll control wasn't appear. Do I have to add scroll object or someting like that
Many thanks again to you Mr. Porcelli
Arie
Maybe you are looking for
-
PB no longer syncs with my Mac
My PB connects with my Mac through the Blackberry Desktop but when I press the sync button, the popup screen says something like "Prepare to sync" and stays there forever. I stopped it after 15 minutes or so. My last sync was before the latest OS upd
-
How to allocate the freight cost when providing free shipping
We do not charge our customers freight cost. We would like to allocate our freight cost to the product cost of each item sold. Can we allocate our freight cost in the delivery note, then copy the delivery note to the customer invoice and remove the
-
I have a customer who uses Adobe Acrobat Pro 11. When she receives PDFs, she cannot see the color green, certain boxes(most of the ones she cannot see all have green in them),and pictures. When I opened this same PDF document in Adobe Reader 11, Ad
-
How to search and replace in an xml file using java
Hi all, I am new to java and Xml Programming. I have to search and replace a value Suresh with some other name in the below xml file. Any help of code in java it is of great help,and its very urgent. I am using java swings for generating two text box
-
How to convert audio to 'uncompressed' audio
It is obvious from all the reports, that there is a problem with FCPX audio en 'Lion". I have experienced this too. To avoid this I have been trying to convert the audio of my movies to aiff. So far I didn't succeed. My camcorder (panasonic SD900) r