Hi,
I want to know how to convert datatable into pdf file.I am using a database table in sql server and it contains the values as follows
p_id name city
1 hansen sandnes
2 syendson sandnes
3 pettersen stavanger
4 krishna chennai
6 raman banglore
7 kumar coimbatore
9 raman sandnes
i want to convert the above table into a pdf file using c#.net ,how to do it please help me
thanks in advance
Loading
TrinityPosted Sep 27, 2009, 5:32 PM
You create a crsytal report file separatly that consumes data from your sql server data base then you export it to pdf using this code
//Instantiate a new report document
ReportDocument oDoc = new ReportDocument();
//load myCrReport
oDoc.Load(@"C:\myCrReport.rpt");
DataSet myDataSet = new DataSet();
// write code here to fill the data set
DiskFileDestinationOptions destination = new DiskFileDestinationOptions();
destination.DiskFileName = @"C:\Content.pdf";
// Set the data source of the report document
oDoc.SetDataSource(myDataSet.Tables["Table"]);
CrystalDecisions.Shared.ExportOptions option = new ExportOptions();
option.ExportFormatType = ExportFormatType.PortableDocFormat;
oDoc.Export(option);