Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        /// <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);
        }