public static ReportExecuter Load(Report musTemp, DataSet customDataSource) { ReportExecuter t = new ReportExecuter(); t.musTemp = musTemp; t.customDataSource = customDataSource; return t; }
public static ReportExecuter Load(Report musTemp, string customSQL, Hashtable sqlParams) { ReportExecuter t = new ReportExecuter(); t.musTemp = musTemp; t.customSQL = customSQL; t.sqlParams = sqlParams; return t; }
public void ExportToFile(ReportExecuter template, string docType, string title, string fileName) { if (docType == "EKRAN") { report.ShowPreview(); return; } if (string.IsNullOrEmpty(fileName)) fileName = title.MakeFileName(); else fileName = fileName.MakeFileName(); string dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\CinarDocs"; if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); Process.Start(dir); using (MemoryStream st = new MemoryStream()) { switch (docType) { case "CSV": CsvExportOptions csvOptions = new CsvExportOptions(); csvOptions.Encoding = Encoding.GetEncoding(1254); template.ExportToCsv(st, csvOptions); break; case "HTM": template.ExportToHtml(st, new HtmlExportOptions("UTF8", title, true)); break; case "JPG": template.ExportToImage(st, new ImageExportOptions(ImageFormat.Jpeg)); break; case "MHT": template.ExportToMht(st, new MhtExportOptions("UTF8")); break; case "PDF": template.ExportToPdf(st, new PdfExportOptions()); break; case "RTF": template.ExportToRtf(st, new RtfExportOptions()); break; case "TXT": template.ExportToText(st, new TextExportOptions("", Encoding.UTF8)); break; case "XLS": template.ExportToXls(st, new XlsExportOptions(TextExportMode.Value, false, true)); break; } string path = dir + "\\" + fileName + "." + docType; File.WriteAllBytes(path, st.ToArray()); } }