private static Report CreateReport() { var r = new Report(); r.AddHeader(1, "Test"); r.AddPlot(new PlotModel { Title = "Plot 1" }, "First plot", 600, 400); r.AddPlot(new PlotModel { Title = "Plot 2" }, "Second plot", 600, 400); return r; }
public void ExportToStream_ReportWithNoCaptions_CheckThatOutputFileExists() { const string FileName = "ReportWithNoPlotCaptions.pdf"; var s = File.Create(FileName); var r = new Report(); r.AddHeader(1, "Test"); r.AddPlot(new PlotModel { Title = "Plot 1" }, null, 600, 400); r.AddPlot(new PlotModel { Title = "Plot 2" }, null, 600, 400); using (var w = new PdfReportWriter(s)) { w.WriteReport(r, new ReportStyle()); } Assert.IsTrue(new FileInfo(FileName).Length > 0); }
static void ProcessReport(ImagePlot[] imageData) { String fileName = "Output.pdf"; if(arguments.Output != null) { fileName = arguments.Output; } try { var s = File.Create(fileName); var r = new Report(); r.AddHeader(1, "Output generated: "+DateTime.Now); int numReports = arguments.Graphs; int height = 0; switch (numReports) { case 1: height = 800; break; case 2: height = 600; break; default: height = 400; break; } foreach(ImagePlot data in imageData) { r.AddPlot(data.plot, null, 800, height); } //if (arguments.Raw && false) //{ // //r.AddParagraph() // r.AddParagraph("this is a test"); //} using (var w = new PdfReportWriter(s)) { w.WriteReport(r, new ReportStyle {}); if (arguments.Verbose) Console.WriteLine("Output to: " + fileName); } } catch (Exception e) { Console.WriteLine("Could not output to file: " + e.Message); } }