private void ExportAsHtml() { string navBar = HtmlHelper.GetHtmlNavBar(GetSelectedTables()); foreach (var value in GetHtml()) { string savePath = Path.Combine(ExportPath, ReportContainerName, $"{value.Item1}.html"); string page = value.Item2.Replace("<%%NAV%%>", navBar); File.WriteAllText(savePath, page); } //combined string combined = DatatableToHtml.ConvertToHtml(GetMergedDataTable(), ExportPath, ReportContainerName); string save = HtmlHelper.ReplaceReportDetails(combined, GSCP, true); save = save.Replace("<%%NAV%%>", navBar); File.WriteAllText(Path.Combine(ExportPath, ReportContainerName, "combined.html"), save); Thread.Sleep(750); string hash = OsirtHelper.CreateHashForFolder(Path.Combine(ExportPath, ReportContainerName)); Logger.Log(new OsirtActionsLog(Enums.Actions.Report, hash, ReportContainerName)); PlaceReportInContainer(Path.Combine(ExportPath, ReportContainerName)); if (openReport) { Process.Start(Path.Combine(ExportPath, ReportContainerName, "combined.html")); } }
private void ExportAsPdf() { string page = DatatableToHtml.ConvertToHtml(GetMergedDataTable(), ExportPath, ReportContainerName); string save = HtmlHelper.ReplaceReportDetails(page, GSCP, false); HtmLtoPdf.SaveHtmltoPdf(save, GSCP, "audit log", Path.Combine(ExportPath, ReportContainerName, Constants.PdfReportName)); string hash = OsirtHelper.CreateHashForFolder(Path.Combine(ExportPath, ReportContainerName)); Logger.Log(new OsirtActionsLog(Enums.Actions.Report, hash, ReportContainerName)); PlaceReportInContainer(Path.Combine(ExportPath, ReportContainerName)); if (openReport) { Process.Start(Path.Combine(ExportPath, ReportContainerName, Constants.PdfReportName)); } }