/// <summary> /// 创建报表 /// </summary> /// <returns></returns> private Rdl.Report CreateReport() { Rdl.Report report = new Rdl.Report(); string w = "", h = "", lm = "", tm = "", rm = "", bm = ""; //设置报表页面 if (!string.IsNullOrEmpty(_rpc.Unit)) { w = _rpc.Width + _rpc.Unit; h = _rpc.Height + _rpc.Unit; lm = _rpc.LeftMargin + _rpc.Unit; tm = _rpc.TopMargin + _rpc.Unit; rm = _rpc.RightMargin + _rpc.Unit; bm = _rpc.BottomMargin + _rpc.Unit; } else { w = (_rpc.PageSettings.PaperSize.Width / 96.0) + "in"; h = (_rpc.PageSettings.PaperSize.Height / 96.0) + "in"; lm = (_rpc.LeftMargin / 96.0) + "in"; tm = (_rpc.TopMargin / 96.0) + "in"; rm = (_rpc.RightMargin / 96.0) + "in"; bm = (_rpc.BottomMargin / 96.0) + "in"; } report.Items = new object[] { CreateDataSources(), CreateHeader(), CreateBody(), CreateFooter(), CreateDataSets(), w, h, lm, tm, rm, bm, }; report.ItemsElementName = new Rdl.ItemsChoiceType37[] { Rdl.ItemsChoiceType37.DataSources, Rdl.ItemsChoiceType37.PageHeader, Rdl.ItemsChoiceType37.Body, Rdl.ItemsChoiceType37.PageFooter, Rdl.ItemsChoiceType37.DataSets, Rdl.ItemsChoiceType37.Width, Rdl.ItemsChoiceType37.PageHeight, Rdl.ItemsChoiceType37.LeftMargin, Rdl.ItemsChoiceType37.TopMargin, Rdl.ItemsChoiceType37.RightMargin, Rdl.ItemsChoiceType37.BottomMargin, }; return(report); }
/// <summary> /// 创建报表 /// </summary> /// <returns></returns> private Rdl.Report CreateReport() { Rdl.Report report = new Rdl.Report(); string w = "", h = "", lm = "", tm = "", rm = "", bm = ""; //设置报表页面 if(!string.IsNullOrEmpty(_rpc.Unit)) { w = _rpc.Width + _rpc.Unit; h = _rpc.Height + _rpc.Unit; lm = _rpc.LeftMargin + _rpc.Unit; tm = _rpc.TopMargin + _rpc.Unit; rm = _rpc.RightMargin + _rpc.Unit; bm = _rpc.BottomMargin + _rpc.Unit; } else { w = (_rpc.PageSettings.PaperSize.Width / 96.0) + "in"; h = (_rpc.PageSettings.PaperSize.Height / 96.0) + "in"; lm = (_rpc.LeftMargin / 96.0) + "in"; tm = (_rpc.TopMargin / 96.0) + "in"; rm = (_rpc.RightMargin / 96.0) + "in"; bm = (_rpc.BottomMargin / 96.0) + "in"; } report.Items = new object[] { CreateDataSources(), CreateHeader(), CreateBody(), CreateFooter(), CreateDataSets(), w, h, lm, tm, rm, bm, }; report.ItemsElementName = new Rdl.ItemsChoiceType37[] { Rdl.ItemsChoiceType37.DataSources, Rdl.ItemsChoiceType37.PageHeader, Rdl.ItemsChoiceType37.Body, Rdl.ItemsChoiceType37.PageFooter, Rdl.ItemsChoiceType37.DataSets, Rdl.ItemsChoiceType37.Width, Rdl.ItemsChoiceType37.PageHeight, Rdl.ItemsChoiceType37.LeftMargin, Rdl.ItemsChoiceType37.TopMargin, Rdl.ItemsChoiceType37.RightMargin, Rdl.ItemsChoiceType37.BottomMargin, }; return report; }
private Rdl.Report CreateReport() { Rdl.Report report = new Rdl.Report(); report.Items = new object[] { CreateDataSources(), CreateBody(), CreateDataSets(), m_widthInches + "in", }; report.ItemsElementName = new Rdl.ItemsChoiceType37[] { Rdl.ItemsChoiceType37.DataSources, Rdl.ItemsChoiceType37.Body, Rdl.ItemsChoiceType37.DataSets, Rdl.ItemsChoiceType37.Width, }; return(report); }
private Rdl.Report CreateReport() { Rdl.Report report = new Rdl.Report(); report.Items = new object[] { CreateDataSources(), CreateBody(), CreateDataSets(), "6.5in", }; report.ItemsElementName = new Rdl.ItemsChoiceType37[] { Rdl.ItemsChoiceType37.DataSources, Rdl.ItemsChoiceType37.Body, Rdl.ItemsChoiceType37.DataSets, Rdl.ItemsChoiceType37.Width, }; return report; }
private Rdl.Report CreateReport() { var report = new Rdl.Report { Items = new object[] { CreateDataSources(), CreateBody(), CreateDataSets(), "6.5in" }, ItemsElementName = new[] { Rdl.ItemsChoiceType37.DataSources, Rdl.ItemsChoiceType37.Body, Rdl.ItemsChoiceType37.DataSets, Rdl.ItemsChoiceType37.Width } }; return(report); }
public static void geraRelatorio(string nomeProjeto, string[] sqlines, string reportPath) { ReportViewer rptViewer = new ReportViewer(); foreach (string sqline in sqlines) { string[] composicaoSqline = sqline.Split(';'); DataTable dt = Utilities.GetDataTable(composicaoSqline[1]); StreamReader str = new StreamReader(reportPath); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Rdl.Report)); Rdl.Report rpt = (Rdl.Report)serializer.Deserialize(str.BaseStream); MemoryStream ms = new MemoryStream(); XmlSerializer serial = new XmlSerializer(typeof(Rdl.Report)); serial.Serialize(ms, rpt); ms.Position = 0; rptViewer.compRptViewer.LocalReport.LoadReportDefinition(ms); rptViewer.compRptViewer.LocalReport.DataSources.Add(new ReportDataSource(nomeProjeto + "_" + composicaoSqline[0], dt)); } //rptViewer.MdiParent = Main.ActiveForm; rptViewer.StartPosition = FormStartPosition.CenterScreen; rptViewer.Show(); }
public static Rdl.Report CreateReport(string groupBy, string fromDate, string toDate, string billStatus, string reportName) { Rdl.Report report = new Rdl.Report(); try { report.Items = new object[] { CreateDataSources(), //Creates Data source CreateHeader(groupBy, fromDate, toDate, billStatus, reportName), //create the header and pass the groupby, which we selected in the combobox so that it will be printed in header of report in order to exlain that this table is grouped by which column. CreateBody(groupBy), //Create Body of the report which will contain the table and the data it contains with the groupby display. CreateDataSets(), //Create Dataset corresponding to Datasource "8.5in", //set the size of reporti inches "8.5in", //set the size of reporti inches "11in", //set the size of reporti inches "0.5in", "0.5in", "0.5in", "0.5in", }; report.ItemsElementName = new Rdl.ItemsChoiceType37[] { Rdl.ItemsChoiceType37.DataSources, Rdl.ItemsChoiceType37.PageHeader, Rdl.ItemsChoiceType37.Body, Rdl.ItemsChoiceType37.DataSets, Rdl.ItemsChoiceType37.Width, Rdl.ItemsChoiceType37.PageWidth, Rdl.ItemsChoiceType37.PageHeight, Rdl.ItemsChoiceType37.TopMargin, Rdl.ItemsChoiceType37.BottomMargin, Rdl.ItemsChoiceType37.LeftMargin, Rdl.ItemsChoiceType37.RightMargin, }; } catch (Exception ex) { } return(report); }