Solved

Exporting Crystal report withh dynamic image in C#

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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