private void StartMHT() { subFolder = false; singlePage = true; navigator = false; mimeStream = new MemoryStream(); boundary = ExportUtils.GetID(); }
/// <inheritdoc/> protected override void Start() { FCSSStyles = new List <string>(); FHPos = 0; FCount = Report.PreparedPages.Count; FPagesCount = 0; FPrevWatermarkName = String.Empty; FPrevWatermarkSize = 0; FPrevStyleList = null; FPrevStyleListIndex = 0; if (!FWebMode) { if (FFormat == HTMLExportFormat.MessageHTML) { FSubFolder = false; FSinglePage = true; FNavigator = false; FMimeStream = new MemoryStream(); FBoundary = ExportUtils.GetID(); } if (!FNavigator) { FSinglePage = true; } if (FileName == "" && Stream != null) { FTargetFileName = "html"; FSinglePage = true; FNavigator = false; if (FFormat == HTMLExportFormat.HTML) { FPictures = false; } } else { FTargetFileName = Path.GetFileNameWithoutExtension(FileName); FFileName = FTargetFileName; FTargetIndexPath = Path.GetDirectoryName(FileName); } if (!String.IsNullOrEmpty(FTargetIndexPath)) { FTargetIndexPath += "\\"; } if (FSubFolder) { FSubFolderPath = FTargetFileName + ".files\\"; FTargetPath = FTargetIndexPath + FSubFolderPath; FTargetFileName = FSubFolderPath + FTargetFileName; if (!Directory.Exists(FTargetPath)) { Directory.CreateDirectory(FTargetPath); } } else { FTargetPath = FTargetIndexPath; } FNavFileName = FTargetFileName + ".nav.html"; FOutlineFileName = FTargetFileName + ".outline.html"; FDocumentTitle = Report.ReportInfo.Name.Length != 0 ? Report.ReportInfo.Name : Path.GetFileNameWithoutExtension(FileName); if (FSinglePage) { if (FNavigator) { FSinglePageFileName = FTargetIndexPath + FTargetFileName + ".main.html"; using (Stream PageStream = new FileStream(FSinglePageFileName, FileMode.Create)) using (StreamWriter Out = new StreamWriter(PageStream)) { Out.Write(String.Format(FTemplates.PageTemplateTitle, FDocumentTitle)); if (FPrint) { Out.WriteLine(PRINT_JS); } Out.WriteLine(BODY_BEGIN); } } else { FSinglePageFileName = FileName; Stream PagesStream; if (FFormat == HTMLExportFormat.HTML) { PagesStream = Stream; } else { PagesStream = FMimeStream; } ExportUtils.Write(PagesStream, String.Format(FTemplates.PageTemplateTitle, FDocumentTitle)); if (FPrint) { ExportUtils.WriteLn(PagesStream, PRINT_JS); } ExportUtils.WriteLn(PagesStream, BODY_BEGIN); } } } else { FPages.Clear(); for (int i = 0; i < FCount; i++) { FPages.Add(new HTMLPageData()); } } if (!FSinglePage && FThreaded) { FFirstPageEvent = new ManualResetEvent(false); } }
/// <inheritdoc/> protected override void Start() { htmlMeasureGraphics = Report.MeasureGraphics; cssStyles = new List <string>(); hPos = 0; count = Report.PreparedPages.Count; pagesCount = 0; prevWatermarkName = String.Empty; prevWatermarkSize = 0; prevStyleList = null; prevStyleListIndex = 0; picsArchive = new List <PicsArchiveItem>(); generatedStreams = new List <Stream>(); if (saveStreams) { if (singlePage) { GeneratedUpdate("index.html", null); } subFolder = false; navigator = false; //FSinglePage = true; } if (!webMode) { if (format == HTMLExportFormat.MessageHTML) { subFolder = false; singlePage = true; navigator = false; mimeStream = new MemoryStream(); boundary = ExportUtils.GetID(); } if (FileName == "" && Stream != null) { targetFileName = "html"; singlePage = true; subFolder = false; navigator = false; if (format == HTMLExportFormat.HTML && !embedPictures) { pictures = false; } } else { targetFileName = Path.GetFileNameWithoutExtension(FileName); fileName = targetFileName; targetIndexPath = !String.IsNullOrEmpty(FileName) ? Path.GetDirectoryName(FileName) : FileName; } if (!String.IsNullOrEmpty(targetIndexPath)) { targetIndexPath += Path.DirectorySeparatorChar; } if (preview) { pictures = true; printPageData = new HTMLPageData(); } else if (subFolder) { subFolderPath = targetFileName + ".files" + Path.DirectorySeparatorChar; targetPath = targetIndexPath + subFolderPath; targetFileName = subFolderPath + targetFileName; if (!Directory.Exists(targetPath)) { Directory.CreateDirectory(targetPath); } } else { targetPath = targetIndexPath; } navFileName = targetFileName + ".nav.html"; //FOutlineFileName = FTargetFileName + ".outline.html"; documentTitle = (!String.IsNullOrEmpty(Report.ReportInfo.Name) ? Report.ReportInfo.Name : Path.GetFileNameWithoutExtension(FileName)); if (singlePage) { if (navigator) { singlePageFileName = targetIndexPath + targetFileName + ".main.html"; if (saveStreams) { MemoryStream PageStream = new MemoryStream(); ExportUtils.Write(PageStream, String.Format(templates.PageTemplateTitle, documentTitle)); if (print) { ExportUtils.WriteLn(PageStream, PRINT_JS); } ExportUtils.WriteLn(PageStream, BODY_BEGIN); GeneratedUpdate(singlePageFileName, PageStream); } else { using (Stream PageStream = new FileStream(singlePageFileName, FileMode.Create)) using (StreamWriter Out = new StreamWriter(PageStream)) { Out.Write(String.Format(templates.PageTemplateTitle, documentTitle)); if (print) { Out.WriteLine(PRINT_JS); } Out.WriteLine(BODY_BEGIN); } } } else { singlePageFileName = String.IsNullOrEmpty(FileName) ? "index.html" : FileName; Stream PagesStream; if (saveStreams) { PagesStream = new MemoryStream(); GeneratedUpdate(singlePageFileName, PagesStream); } else { if (format == HTMLExportFormat.HTML) { PagesStream = Stream; } else { PagesStream = mimeStream; } } ExportUtils.Write(PagesStream, String.Format(templates.PageTemplateTitle, documentTitle)); if (print) { ExportUtils.WriteLn(PagesStream, PRINT_JS); } ExportUtils.WriteLn(PagesStream, BODY_BEGIN); } } } else { pages.Clear(); for (int i = 0; i < count; i++) { pages.Add(new HTMLPageData()); } } }