/// <summary> /// Generate statistic report /// return pdf path of statistic report /// </summary> /// <param name="start">open pdf</param> /// <returns></returns> public static string draw(bool start = true) { var chartNames = new List <String> { "NbrDupFileByTime", "SizeDupFileByTime", "NewDuplicateSizeByUser", "NbrFileByTime", "ExtByType", "ExtBySize", "NbrByModAge", "NbrByAccAge", "ByStatus", "DuplicateNbrByUser", "DuplicateSizeByUser", "DuplicateSizeByExt", "SizeByPath" }; //var chartNames = new List<String> { "SizeByPath" }; var document = new PdfDocument(); foreach (string chartName in chartNames) { IStatChart ch = Activator.CreateInstance(Type.GetType("duplicateFile.Classes.Charts." + chartName)) as IStatChart; //new ByType(); var View = getData(ch.Sql); XFont titleFont = new XFont("Verdana", 20, XFontStyle.Bold); var page = document.AddPage(); page.Orientation = PdfSharp.PageOrientation.Landscape; var gfx = XGraphics.FromPdfPage(page); //add title gfx.DrawString(ch.Title, titleFont, XBrushes.Black, new XRect(0, 0, page.Width, 50), XStringFormat.Center); //add chart Chart c = ch.draw(View); ChartTools.setPoint(c, ch); addPage(page, c, gfx); } var tempPath = Path.ChangeExtension(Path.GetTempFileName(), "pdf"); document.Save(tempPath);//.Save(ms); if (start) { System.Diagnostics.Process.Start(tempPath); } return(tempPath); }