private void GeneratePage(Template template, int pageIndex) { VelocityContext.Put("pageIndex", pageIndex); string reportPath = Helper.Paging.GetReportPath(pageIndex); var stringBuilder = new StringBuilder(); using (var stringWriter = new StringWriter(stringBuilder)) { template.Merge(VelocityContext, stringWriter); using (var fileWriter = new StreamWriter(ReportWriter.ReportContainer.OpenWrite(reportPath, ContentType, encoding))) { fileWriter.Write(FormatHtmlHelper.Flatten(stringBuilder.ToString())); } } ReportWriter.AddReportDocumentPath(reportPath); }
/// <inheritdoc /> public override void Run() { Encoding encoding = new UTF8Encoding(false); string reportPath = Helper.Paging.GetReportPath(0); Template template = VelocityEngine.GetTemplate(Path.GetFileName(TemplatePath), encoding.BodyName); var stringBuilder = new StringBuilder(); using (var stringWriter = new StringWriter(stringBuilder)) { template.Merge(VelocityContext, stringWriter); using (var fileWriter = new StreamWriter(ReportWriter.ReportContainer.OpenWrite(reportPath, ContentType, encoding))) { fileWriter.Write(FormatHtmlHelper.Flatten(stringBuilder.ToString())); } } ReportWriter.AddReportDocumentPath(reportPath); }