Solved

Exporting Crystal report withh dynamic image in C#

Posted on 2016-09-13
5
42 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 100

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 100

Accepted Solution

by:
mlmcc earned 500 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 100

Expert Comment

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

mlmcc
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now