Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Exporting Crystal report withh dynamic image in C#

Posted on 2016-09-13
5
Medium Priority
?
191 Views
Last Modified: 2016-09-14
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(_crreportlocation);
                TableLogOnInfo logon=new TableLogOnInfo();
                for (int i = 0; i < crReport.Database.Tables.Count; i++)
                {
                    logon = crReport.Database.Tables[i].LogOnInfo;
                    logon.ConnectionInfo.UserID = "userid";
                    logon.ConnectionInfo.Password = "userpsw";
                    crReport.Database.Tables[i].ApplyLogOnInfo(logon);
                }
                             
                //start export
                DiskFileDestinationOptions dfdo = new DiskFileDestinationOptions();
             
                dfdo.DiskFileName = _exportfilelocation;
                crReport.ExportOptions.DestinationOptions = dfdo;
                crReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                crReport.ExportOptions.ExportFormatType = exportformat;
                for (int i = 0; i < _paramcount; i++)
                {
                    crReport.SetParameterValue(parname_value[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
0
Comment
Question by:crcsupport
  • 3
  • 2
5 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 41796953
What version of Crystal are you using?

What version of Visual Studio?

Did you update the references to match the version of Visual Studio?

mlmcc
0
 
LVL 1

Author Comment

by:crcsupport
ID: 41797062
Crystal Report 11.5 and VS 2008
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 41797265
Have you tried using the Crystal for .Net?

CR XI R2 (v11.5) was specifically for .Net 2.0 and VS2005.

According to these references CR XI R2 is only supported on .Net 2.0 and earlier.  If you are using .Net 3.0 and later that may be the problem.  ALso it is not supported on VS2008 and later.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0fbebaf-07e0-2c10-ad9a-d45810ae7109?overridelayout=true&46316927477765

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50e8f572-48d0-2c10-4ea6-83bf8567e28a?overridelayout=true

VS2008 Crystal runtime library
http://scn.sap.com/docs/DOC-27942

mlmcc
0
 
LVL 1

Author Comment

by:crcsupport
ID: 41798257
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.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 41798906
What didn't work using Crystal.Net?

mlmcc
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question