日期:2014-05-16 浏览次数:21300 次
this.reportViewer1.Reset(); this.reportViewer1.LocalReport.LoadReportDefinition(m_rdl); this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("MyData", m_dataSet.Tables[0])); this.reportViewer1.RefreshReport();
private MemoryStream GenerateRdl(List<string> allFields, List<string> selectedFields) { MemoryStream ms = new MemoryStream(); RdlGenerator gen = new RdlGenerator(); gen.AllFields = allFields; gen.SelectedFields = selectedFields; gen.WriteXml(ms); ms.Position = 0; return ms; }
namespace Rdl { using System.Xml.Serialization; /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] [System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition", IsNullable=false)] public partial class Report { private object[] itemsField;
public MemoryStream GenerateRdlc() { XmlDocument sourceDoc = new XmlDocument(); string path = AppDomain.CurrentDomain.BaseDirectory + "Test/OrderList.rdlc"; sourceDoc.Load(path); Hashtable reportColumns = GetReportColumns(sourceDoc.LastChild); //just remove for (int i = 0; i < reportColumns.Count; i++) { if (!FindReportCoulmns(reportColumns[i].ToString())) { RemoveColumnFromRdlc(sourceDoc.LastChild, i); } } MemoryStream ms = new MemoryStream(); XmlSerializer serializer = new XmlSerializer(typeof(XmlDocument)); serializer.Serialize(ms, sourceDoc); ms.Position = 0; return ms; }
private Hashtable GetReportColumns(XmlNode root) { Hashtable cols = new Hashtable(); //XmlNamespaceManager s=new XmlNamespaceManager( XmlNode cells = FindChildNode(roo