public void ProcessRequest(HttpContext context) { var exportReport = getReport(); var reportData = generateReportData(); exportReport.DataSource = reportData; Telerik.Reporting.InstanceReportSource exportReportSource = new Telerik.Reporting.InstanceReportSource(); // Assigning the Report object to the InstanceReportSource exportReportSource.ReportDocument = exportReport; // set any deviceInfo settings if necessary //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); var result = reportProcessor.RenderReport("PDF", exportReportSource, null); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = result.MimeType; HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Private); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Buffer = true; //Uncomment to handle the file as attachment HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;FileName=\"標籤{0:yyyyMMddHHmmss}_{1}.pdf\"", DateTime.Now, reportData[0].Name )); HttpContext.Current.Response.BinaryWrite(result.DocumentBytes); HttpContext.Current.Response.End(); }
protected void ButtonDene_Click(object sender, EventArgs e) { //Create new CultureInfo var cultureInfo = new System.Globalization.CultureInfo("tr-TR"); // Set the language for static text (i.e. column headings, titles) System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo; // Set the language for dynamic text (i.e. date, time, money) System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; EFDal ed = new EFDal(); var instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = new KalibrasyonRaporlari.KYS(); this.KYSReport.ReportSource = instanceReportSource; Telerik.Reporting.Report report = (Telerik.Reporting.Report)instanceReportSource.ReportDocument; report.ReportParameters["BolgeKodu"].Value = 1; //report.ReportParameters[0].Value = 1; report.ReportParameters["BasTar"].Value = DateTime.Parse("2015-01-01"); report.ReportParameters["SonTar"].Value = DateTime.Parse("2015-06-01"); Telerik.Reporting.TextBox txtAciklama = report.Items.Find("txtAciklama", true)[0] as Telerik.Reporting.TextBox; txtAciklama.Value = ed.BolgeKodundanBolgeAdiniDon(Convert.ToInt32(report.ReportParameters["BolgeKodu"].Value)) + " bölgesi için " + report.ReportParameters["BasTar"].Value.ToString().Replace(" 00:00:00", "") + " ve " + report.ReportParameters["SonTar"].Value.ToString().Replace(" 00:00:00", "") + " tarihleri arasında gecikme sürelerini aşağıda görebilirsiniz"; }
protected void ButtonDene_Click(object sender, EventArgs e) { //Create new CultureInfo var cultureInfo = new System.Globalization.CultureInfo("tr-TR"); // Set the language for static text (i.e. column headings, titles) System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo; // Set the language for dynamic text (i.e. date, time, money) System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; EFDal ed = new EFDal(); var instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = new KalibrasyonRaporlari.KYS(); this.KYSReport.ReportSource = instanceReportSource; Telerik.Reporting.Report report = (Telerik.Reporting.Report)instanceReportSource.ReportDocument; report.ReportParameters["BolgeKodu"].Value = 1; //report.ReportParameters[0].Value = 1; report.ReportParameters["BasTar"].Value = DateTime.Parse("2015-01-01"); report.ReportParameters["SonTar"].Value = DateTime.Parse("2015-06-01"); Telerik.Reporting.TextBox txtAciklama = report.Items.Find("txtAciklama", true)[0] as Telerik.Reporting.TextBox; txtAciklama.Value = ed.BolgeKodundanBolgeAdiniDon(Convert.ToInt32(report.ReportParameters["BolgeKodu"].Value)) + " bölgesi için " + report.ReportParameters["BasTar"].Value.ToString().Replace(" 00:00:00", "") + " ve " + report.ReportParameters["SonTar"].Value.ToString().Replace(" 00:00:00", "") + " tarihleri arasında gecikme sürelerini aşağıda görebilirsiniz"; }
public void ProcessRequest(HttpContext context) { var exportReport = getReport(); var reportData =generateReportData(); exportReport.DataSource = reportData; Telerik.Reporting.InstanceReportSource exportReportSource = new Telerik.Reporting.InstanceReportSource(); // Assigning the Report object to the InstanceReportSource exportReportSource.ReportDocument = exportReport; // set any deviceInfo settings if necessary //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); var result = reportProcessor.RenderReport("PDF", exportReportSource, null); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = result.MimeType; HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Private); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Buffer = true; //Uncomment to handle the file as attachment HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;FileName=\"標籤{0:yyyyMMddHHmmss}_{1}.pdf\"", DateTime.Now, reportData[0].Name )); HttpContext.Current.Response.BinaryWrite(result.DocumentBytes); HttpContext.Current.Response.End(); }
private void SaveReport(Telerik.Reporting.Report report, string fileName) { ReportProcessor reportProcessor = new ReportProcessor(); Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = report; RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null); using (FileStream fs = new FileStream(fileName, FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); } }
public ReportSource GetReportDocument() { Report reportObj; var rManager = new ReportManager(); var irs = new Telerik.Reporting.InstanceReportSource(); reportObj = new Report1(); reportObj.DataSource = rManager.GetAdmissionApplicant(); irs.ReportDocument = reportObj; SaveReportProgramatically(reportObj, "C:\\MyReport.pdf"); return(irs); }
public void BindDataset() { var objectDataSource = new Telerik.Reporting.ObjectDataSource(); string selectCommandText = ""; string Start = Monthstartlbl.Text.ToString(); string End = Monthendlbl.Text.ToString(); //Getting Datasouce SqlConnection con = new SqlConnection(Repository.Connection.DBConnectionString()); SqlCommand mySqlCommand = con.CreateCommand(); mySqlCommand.CommandText = "ReportHartford_byDate_sp"; mySqlCommand.Parameters.Add("@Startdate", SqlDbType.NVarChar, -1).Value = Start; mySqlCommand.Parameters.Add("@Enddate", SqlDbType.NVarChar, -1).Value = End; mySqlCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(); mySqlDataAdapter.SelectCommand = mySqlCommand; DataTable dt = new DataTable(); con.Open(); mySqlDataAdapter.Fill(dt); objectDataSource.DataSource = dt; CensusHartford HartReport = new CensusHartford(); HartReport.DataSource = objectDataSource; Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource(); reportSource.ReportDocument = HartReport; ReportViewer1.ReportSource = reportSource; }
// call report with reportname and id param void callreport(string RequestId, string Reportname) { Telerik.Reporting.InstanceReportSource typeInstanceSource = new Telerik.Reporting.InstanceReportSource(); Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource(); string reportname; reportname = Reportname; switch (reportname) { #region Transaction case "LeaveTrxEntryByID": LeaveTrxEntryByID LeaveTransaction = new LeaveTrxEntryByID(); typeReportSource.TypeName = typeof(LeaveTrxEntryByID).AssemblyQualifiedName; typeReportSource.Parameters.Add("ID", RequestId); break; case "ReimbursTrxEntryByID": ReimbursTrxEntryByID reimbursTrxEntryByID = new ReimbursTrxEntryByID(); typeReportSource.TypeName = typeof(ReimbursTrxEntryByID).AssemblyQualifiedName; typeReportSource.Parameters.Add("RecordID", RequestId); break; case "ReimbursmentT2byID": ebPayrollReports.Transactions.ID.ReimbursmentT2byID ReimbursmentT2byID = new ebPayrollReports.Transactions.ID.ReimbursmentT2byID(); typeReportSource.TypeName = typeof(ebPayrollReports.Transactions.ID.ReimbursmentT2byID).AssemblyQualifiedName; typeReportSource.Parameters.Add(new Telerik.Reporting.Parameter("RecordID", RequestId)); break; case "TimeSheetbyProject2": //var report = new ebPayrollReports.Transactions.Form.TimeSheetbyProject(); //typeInstanceSource.ReportDocument = report; //this.ReportViewer1.ReportSource = typeInstanceSource; //report.ReportParameters[0].Value = RequestId; ebPayrollReports.Transactions.Form.TimeSheetbyProject f = new ebPayrollReports.Transactions.Form.TimeSheetbyProject(); break; case "TimeSheetbyProject": var report = new ebPayrollReports.Transactions.Form.TimeSheetbyProject(); typeInstanceSource.ReportDocument = report; this.ReportViewer1.ReportSource = typeInstanceSource; report.ReportParameters[0].Value = RequestId; break; case "TimeSheetbyProjectLogs": var report2 = new ebPayrollReports.Transactions.Form.TimeSheetProjectLogs(); typeInstanceSource.ReportDocument = report2; this.ReportViewer1.ReportSource = typeInstanceSource; report2.ReportParameters[0].Value = RequestId; break; #endregion } ReportViewer1.RefreshReport(); }