Solved

Exporting Crystal report withh dynamic image in C#

Posted on 2016-09-13
5
102 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…

752 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