private void button2_Click(object sender, System.EventArgs e) { stiReport1.Load("..\\Variables.mrt"); stiReport1.Compile(); //Set Variables stiReport1["Name"] = tbName.Text; stiReport1["Surname"] = tbSurname.Text; stiReport1["Email"] = tbEmail.Text; stiReport1["Address"] = tbAddress.Text; stiReport1["Sex"] = rbMale.Checked; stiReport1["BirthDay"] = dtBirthDay.Value; stiReport1.Show(); }
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // path = Application.StartupPath + "\\..\\.."; stiReport1.Dictionary.DataStore.Clear(); System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" + path + "\\Data\\NWIND.MDB"); stiReport1.RegData("NorthWind", connection); stiReport1.Compile(); }
/// <summary> /// /// </summary> /// <returns></returns> public virtual ActionResult StiReport() { System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("fa-IR"); // List of persons: // you can change the following list to list of persons that get from database. var persons = new List<Models.Person>() { new Person() {Id = 0, FirstName = "sadar", LastName = "marvati", Gender = true} , new Person() {Id = 1, FirstName = "omid", LastName = "nasri", Gender = true} , new Person() {Id = 2, FirstName = "hana", LastName = "akbari", Gender = false} , new Person() {Id = 3, FirstName = "ali", LastName = "jahani", Gender = true } , new Person() {Id = 4, FirstName = "sara", LastName = "sabori", Gender = false } }; var mainReport = new Stimulsoft.Report.StiReport(); mainReport.Load(Server.MapPath("~/Files/Report.mrt")); mainReport.Compile(); mainReport["DateTimeNow"] = DateTime.UtcNow; mainReport.RegBusinessObject("persons_business", persons); return Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(mainReport); }
/// <summary> /// /// </summary> /// <returns></returns> public virtual ActionResult StiReport() { System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("fa-IR"); // List of persons: // you can change the following list to list of persons that get from database. var persons = new List <Models.Person>() { new Person() { Id = 0, FirstName = "sadar", LastName = "marvati", Gender = true } , new Person() { Id = 1, FirstName = "omid", LastName = "nasri", Gender = true } , new Person() { Id = 2, FirstName = "hana", LastName = "akbari", Gender = false } , new Person() { Id = 3, FirstName = "ali", LastName = "jahani", Gender = true } , new Person() { Id = 4, FirstName = "sara", LastName = "sabori", Gender = false } }; var mainReport = new Stimulsoft.Report.StiReport(); mainReport.Load(Server.MapPath("~/Files/Report.mrt")); mainReport.Compile(); mainReport["DateTimeNow"] = DateTime.UtcNow; mainReport.RegBusinessObject("persons_business", persons); return(Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(mainReport)); }
protected virtual Boolean WfToolbarExecute() { BindingMaster.EndEdit(); string filePath = ""; try { this.errorProvider.Clear(); if (!TabMaster.IsAutoExecuted) //不做條件檢查 --主要由他窗引用 { if (this.WfFormCheck() == false) { //WfRollback(); return(false); } if (this.WfAfterFormCheck() == false) { //WfRollback(); return(false); } } if (GlobalFn.varIsNull(TabMaster.ReportName)) { WfShowErrorMsg("未設定來源報表"); } filePath = Application.StartupPath + @"\reports\" + TabMaster.ReportName; if (!File.Exists(filePath)) { WfShowErrorMsg("無此來源報表路徑!"); } Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport(); rpt.Load(filePath); rpt.ReportName = this.AdoModel.ado10; //產生資料來源 if (this.WfExecReport(rpt) == false) { //WfRollback(); return(false); } rpt.Compile(); rpt["ReportId"] = this.StrFormID; rpt["CompNo"] = this.LoginInfo.CompNo; rpt["CompNameA"] = this.LoginInfo.CompNameA; rpt["DeptNo"] = this.LoginInfo.DeptNo; rpt["DeptName"] = this.LoginInfo.DeptName; rpt["UserNo"] = this.LoginInfo.UserNo; rpt["UserName"] = this.LoginInfo.UserName; if (WfExecReportEnd(rpt) == false) { return(false); } FrmReportDisplayBase rptDisplayBase = new FrmReportDisplayBase(rpt); //rptDisplayBase.stiViewerControl1.ClickPrintButton += stiViewerControl1_ClickPrintButton; //rptDisplayBase.stiViewerControl1.ClickPrintButton += new System.EventHandler(this.stiViewerControl1_ClickPrintButton); rptDisplayBase.stiViewerControl1.Report.CompiledReport.Printed += new EventHandler(report_Print); rptDisplayBase.Show(); if (TabMaster.IsCloseAfterExecuted) { this.Close(); } //if (TabMaster.IsCloseAfterExecuted) // this.Close(); } catch (Exception ex) { throw ex; } finally { //this.Cursor = Cursors.Default; //改到工具列處理 } return(true); }