C# desktop application

D

douglas

I would like to take an existing crystal report 11 (that can run on its own),
and have the report displayed in a C#.net 2005 desktop application. I then
would like to export the crystal report to an excel 2003 file and into a PDF
file within the same control? (or at least the same windows form). Can all of
this be accomplished with a 'report form viewer' or some of kind of controls?
If so, how can this task be accomplished?
If not, how would you suggest the vb.net application run an existing
crystal report and export the file to both excel and pdf formats?

Thanks!
 
B

bob

Hi,
You can use existing external reports with the Crystal Reports Viewer.
Using the report document model
The following snippet is from an app that has report names stored in a
database table.
Once the user chooses a report from a datagrid this code comes into
play.
hth
Bob
Note: the 'crv' object is the crystal reports viewer on the form from
which this code comes from.

CrystalDecisions.Shared.TableLogOnInfo t;
try
{
Cursor = Cursors.WaitCursor;

t = new CrystalDecisions.Shared.TableLogOnInfo();
t.ConnectionInfo.DatabaseName =
mLogger.RegGetStringValue("App", "Database", "Server");

t.ConnectionInfo.UserID = "user";
t.ConnectionInfo.Password = "password";
string sReportFile = mstrReportPath +
dgReports.SelectedRows[0].Cells[1].Value;
string sReport =
dgReports.SelectedRows[0].Cells[1].Value.ToString();


if (!File.Exists(sReportFile))
{
MessageBox.Show("The report " + sReportFile + "
does not exist.", "Unknown File Name.",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}

ReportDocument r;//*************Good stuff starts here
*****************
r = new ReportDocument();
r.Load(sReportFile);

crv.LogOnInfo = new
CrystalDecisions.Shared.TableLogOnInfos();
crv.LogOnInfo.Add(t);
crv.ReportSource = r;


Cursor = Cursors.Default;
return;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top