471,310 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Creating PDF from CR

Hi gurus...

Well my problem might be simple to some of you but I can't figure it out.
Im trying to export Report to pdf in code but I still getting the same
error;

"The process cannot access the file
\"C:\\DOCUME~1\\K10263~1.TNE\\LOCALS~1\\Temp\\expo rt_d6506a79-d0e9-4d98-948c
-c42990ffd9f7.tmp\" because it is being used by another process."

My code looks like this and I marked where my errors appear with
/***************ERROR********************/ ;

private void SaveasPDF()
{
string sFileName = Application.StartupPath + "\\temp\\" + m_iRandom+
DateTime.Now.Ticks.ToString() + ".pdf";

crAutt report = new crAutt();

CrystalDecisions.Shared.ExportOptions exportOpts = report.ExportOptions;
exportOpts.ExportFormatType =
CrystalDecisions.Shared.ExportFormatType.PortableD ocFormat;
exportOpts.ExportDestinationType =
CrystalDecisions.Shared.ExportDestinationType.Disk File;
exportOpts.DestinationOptions = new
CrystalDecisions.Shared.DiskFileDestinationOptions ();

CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = new
CrystalDecisions.Shared.DiskFileDestinationOptions ();
( (
CrystalDecisions.Shared.DiskFileDestinationOptions )report.ExportOptions.Des
tinationOptions ).DiskFileName = sFileName;
PrintForm print = new PrintForm();
//Creating bitmaps with my controls drawn on
DataSet ds = print.CreatePDF(this.pnlSkyrsla);
report.SetDataSource(ds);

Stream st;
/*************** ERROR********************/
st = report.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableD ocFormat);

byte[] arr = new byte[st.Length];

if(arr.Length < (m_iMaxReportSize * 1024))
{

/***************ERROR********************/
report.Export();

ReportViewer view = new ReportViewer();
view.crviewer.ReportSource = report;
view.ShowDialog();

}
else
{
//error
}
}
Jul 21 '05 #1
0 946

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Pawan | last post: by
15 posts views Thread by Carlos Lozano | last post: by
2 posts views Thread by LIN | last post: by
12 posts views Thread by Mats Lycken | last post: by
15 posts views Thread by David Thielen | last post: by
9 posts views Thread by =?Utf-8?B?YmJn?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.