public void GeneratePlainReport_1()
		{
			ReportModel model = ReportModel.Create();

			ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
			generator.GenerateReport();
			
			XDocument doc1 = XDocument.Load(new XmlNodeReader (generator.XmlReport));
			
			XDocument doc2 = new XDocument();
			
			using (XmlWriter w = doc2.CreateWriter()){
				generator.XmlReport.Save (w);
			}
			XDocument doc3 = ReportGenerationHelper.XmlDocumentToXDocument(generator.XmlReport);
			Assert.IsNotNull (doc1);
			Assert.IsNotNull (doc2);
			Assert.IsNotNull (doc2);
			
			var sq = from si in doc1.Descendants() select si;
			Console.WriteLine ("xxxxx");
			foreach (XElement a in sq)
			{
				Console.WriteLine (a.Name);
			}
			
		}
Exemplo n.º 2
0
		public static ReportDesignerView SetupDesigner ()
		{
			
			ReportModel model = ReportModel.Create();
			Properties customizer = new Properties();
			customizer.Set("ReportLayout",GlobalEnums.ReportLayout.ListLayout);
			IReportGenerator generator = new GeneratePlainReport(model,customizer);
			generator.GenerateReport();
			
			OpenedFile file = FileService.CreateUntitledOpenedFile(GlobalValues.PlainFileName,new byte[0]);
			file.SetData(generator.Generated.ToArray());
			return SetupDesigner(file);
		}
		public void CanCreateContentFromFile ()
		{
			ReportModel model = ReportModel.Create();
		ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
			generator.GenerateReport();
			MockOpenedFile mof = new MockOpenedFile(GlobalValues.PlainFileName);
			OpenedFile file = new MockOpenedFile(GlobalValues.PlainFileName);
			file.SetData(generator.Generated.ToArray());
			
			//ICSharpCode.SharpDevelop.Gui.IViewContent v = displayBinding.CreateContentForFile(new MockOpenedFile("test.srd"));
			//Assert.IsNotNull(v,"View should not be 'null'");
		}
		private ReportModel CreateModel()
		{
			ReportModel m = ReportModel.Create();
			Properties customizer = new Properties();
			
			customizer.Set("ReportLayout",GlobalEnums.ReportLayout.ListLayout);
			IReportGenerator generator = new GeneratePlainReport(m,customizer);
			generator.GenerateReport();
			
			ReportLoader rl = new ReportLoader();
//			Console.WriteLine (generator.XmlReport.DocumentElement);
			object root = rl.Load(generator.XmlReport.DocumentElement);
			ReportModel model = root as ReportModel;
			if (model != null) {
				model.ReportSettings.FileName = GlobalValues.PlainFileName;
				FilePathConverter.AdjustReportName(model);
			} else {
				throw new InvalidReportModelException();
			}
			return model;
		}
		private XmlDocument CreateXmlFromModel ()
		{
			ReportModel model = ReportModel.Create();
			ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
			generator.GenerateReport();
			return generator.XmlReport;
		}
		private XmlDocument CreateXmlFromModel ()
		{
			ReportModel model = ReportModel.Create();
			Properties customizer = new Properties();
			
			customizer.Set("ReportLayout",GlobalEnums.ReportLayout.ListLayout);
			IReportGenerator generator = new GeneratePlainReport(model,customizer);
			generator.GenerateReport();
			return generator.XmlReport;
		}