crcsupport
asked on
Exporting Crystal report withh dynamic image in C#
I have the following code to export Crystal report to .pdf file ( VS 3.5):
public string Export(ExportFormatType exportformat, string[,] parname_value)
{
ReportDocument crReport = new ReportDocument();
try
{
//Load the standalone report
crReport.Load(_crreportloc ation);
TableLogOnInfo logon=new TableLogOnInfo();
for (int i = 0; i < crReport.Database.Tables.C ount; i++)
{
logon = crReport.Database.Tables[i ].LogOnInf o;
logon.ConnectionInfo.UserI D = "userid";
logon.ConnectionInfo.Passw ord = "userpsw";
crReport.Database.Tables[i ].ApplyLog OnInfo(log on);
}
//start export
DiskFileDestinationOptions dfdo = new DiskFileDestinationOptions ();
dfdo.DiskFileName = _exportfilelocation;
crReport.ExportOptions.Des tinationOp tions = dfdo;
crReport.ExportOptions.Exp ortDestina tionType = ExportDestinationType.Disk File;
crReport.ExportOptions.Exp ortFormatT ype = exportformat;
for (int i = 0; i < _paramcount; i++)
{
crReport.SetParameterValue (parname_v alue[i, 0], parname_value[i, 1]);
}
crReport.Export();
return "OK";
}
catch (Exception ex)
{
return "CrystalReport. Export: " +ex.Message;
}
finally
{
crReport = null;
}
}
Report has a dynamic image. When I run the report from Crystal reports all images displayed correctly. If I run the code, the images are not loaded. When I did the same in VS 2005 I did not have any issues. Any idea what I am doing wrong ?
Thank you
public string Export(ExportFormatType exportformat, string[,] parname_value)
{
ReportDocument crReport = new ReportDocument();
try
{
//Load the standalone report
crReport.Load(_crreportloc
TableLogOnInfo logon=new TableLogOnInfo();
for (int i = 0; i < crReport.Database.Tables.C
{
logon = crReport.Database.Tables[i
logon.ConnectionInfo.UserI
logon.ConnectionInfo.Passw
crReport.Database.Tables[i
}
//start export
DiskFileDestinationOptions
dfdo.DiskFileName = _exportfilelocation;
crReport.ExportOptions.Des
crReport.ExportOptions.Exp
crReport.ExportOptions.Exp
for (int i = 0; i < _paramcount; i++)
{
crReport.SetParameterValue
}
crReport.Export();
return "OK";
}
catch (Exception ex)
{
return "CrystalReport. Export: " +ex.Message;
}
finally
{
crReport = null;
}
}
Report has a dynamic image. When I run the report from Crystal reports all images displayed correctly. If I run the code, the images are not loaded. When I did the same in VS 2005 I did not have any issues. Any idea what I am doing wrong ?
Thank you
ASKER
Crystal Report 11.5 and VS 2008
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i think i can not achieve this in VS 2008. I tried to use Crystal for .net and it doesn't work.
Thank you for your help.
Thank you for your help.
What didn't work using Crystal.Net?
mlmcc
mlmcc
What version of Visual Studio?
Did you update the references to match the version of Visual Studio?
mlmcc