Showing posts with label Crystal Report. Show all posts
Showing posts with label Crystal Report. Show all posts

Wednesday, December 7, 2011

How to Display Dynamic Images in Crystal Report


How to use Dynamic images in Crystal Report with out Using Database



Step 1: Add Pictures in Crystal report and Suppress all the pictures

For example:
let us Consider 5 pictures A,B,C,D,E. Add those Pictures using Insert Picture Proberty After Adding just supress the all 5 Pictures.

Step 2:
In Your Asp.net Page Just check the the condition according to that remove Suppress option



Code:

using crystalDecisions.Shared;
using crystalDecisions.crystalReports.Engine;

ReportDocument crDoc=new ReportDocument();
crDoc.load(crystalreportpath,OpenReportMethod.OpenReportByTempCopy);
if(id=="A")
{
 crDoc.ReportDefinition.Sections("SectionNameinCrystalReport")
.ReportOject("PicturelabelName").ObjectFormat.EnableSuppress=False
}
else if(id=="B")
{
 crDoc.ReportDefinition.Sections("SectionNameinCrystalReport")
.ReportOject("PicturelabelName").ObjectFormat.EnableSuppress=False
}
else if(id=="C")
{
 crDoc.ReportDefinition.Sections("SectionNameinCrystalReport")
.ReportOject("PicturelabelName").ObjectFormat.EnableSuppress=False
}
else if(id=="D")
{
 crDoc.ReportDefinition.Sections("SectionNameinCrystalReport")
.ReportOject("PicturelabelName").ObjectFormat.EnableSuppress=False
}
else if(id=="E")
{
 crDoc.ReportDefinition.Sections("SectionNameinCrystalReport")
.ReportOject("PicturelabelName").ObjectFormat.EnableSuppress=False
}

Saturday, December 4, 2010

How To Create Crystal Report In C#

1). Create XML File That Used In this Reports.
So,How To Create That XML File.
1). To Creating that XML Using Dataset.
2). First Fill Dataset From DataAdapter.After That there is one property WriteXMLSchema Of Dataset.In this Property write the XML FIle Name.
2). After Creating that XML File.Right Click On Project And Click On  Add New Item.While Click On that One Open Dialog Box Appear.From that Dialog Box Click On Crystal Report.That will Add One Crystal Report On your Solution.
3). After Creating Rpt File Follows That Following Steps.
1). Add Datasource Of that newly created Crystal Report And Click On Database Expert… link.











2). Click On That One Dialog Box Appear that Describe below.
 


















3). When Expand that Database files Option It will ask the Location Of that XML give.Give the location Of that XML File.


















4). After Click On Open Button This Screen Appear.From That Choose the Table that will see on that Report.



















4). All This Task Complate That Write the below code For Bind the Data To ReportViewer .
ReportDocument rdoc = new ReportDocument();
// Path Of That Report Document File In Load Function Parameter.
rdoc.Load(@”C:\Documents and Settings\xosysadmin\My Documents\Visual Studio 2005\Projects\GivingXMLToRpt\GivingXMLToRpt\Testrpt.rpt”);
// Give the Dataset Name That Assing To Report Document
rdoc.SetDataSource(ds);
// Viewer Name . ReportSource = That Report Document Object Name
crystalReportViewer1.ReportSource = rdoc;