protected override bool RenderInternal(ref MemoryStream chunk, out string mime) { mime = null; try { /* this is about rendering: * what does the user want us to render -> * see if this renderer can do what she asks for */ if (Outputformat == FileType.ft_html) { /* expect this to be delivered: */ mime = SetResultDisposition(ResultFileBasename + ".html", FileType.ft_html); if (chunk == null) { chunk = new MemoryStream(); } /* employ a html rendering engine */ var engine = new HtmlTemplateEngine(chunk); /* compose the parts */ if (DoRenderHeaderUsingTemplate) { engine.RenderHeader( this, PresentationOptions.HasFlag(ReportPresentationOptions.ShowTitle), PresentationOptions.HasFlag(ReportPresentationOptions.ShowLogo) ); } if (DoRenderMetaUsingTemplate) { engine.RenderMetadata( this, PresentationOptions.HasFlag(ReportPresentationOptions.ShowMetadata), PresentationOptions.HasFlag(ReportPresentationOptions.ShowCriteria), PresentationOptions.HasFlag(ReportPresentationOptions.ShowQRCode) ); } /* the actual content (report rendition) */ RenderBody(engine); /* submit everything */ engine.SubmitToStream(this); } else if (Outputformat == FileType.ft_pdf) { /* use TEX to render as a pdf */ } else { /* cannot render that... */ throw new NotSupportedException(Outputformat.ToString()); } /* succeeded */ return(true); } catch (Exception ex) { /* some error */ OnBuiltinReportError(ex.Message, ex); return(false); } }
protected override bool RenderInternal(ref MemoryStream chunk, out string mime) { mime = null; try { /* this is about rendering: * what does the user want us to render -> * see if this renderer can do what she asks for */ if (Outputformat == FileType.ft_html || Outputformat == FileType.ft_pdf) { /* expect this to be delivered: */ mime = SetResultDisposition(ResultFileBasename, Outputformat); if (chunk == null) { chunk = new MemoryStream(); } /* employ a html rendering engine */ var engine = new HtmlTemplateEngine(chunk); /* compose the parts */ engine.RenderHeader( this, PresentationOptions.HasFlag(ReportPresentationOptions.ShowTitle), PresentationOptions.HasFlag(ReportPresentationOptions.ShowLogo) ); engine.RenderMetadata( this, PresentationOptions.HasFlag(ReportPresentationOptions.ShowMetadata), PresentationOptions.HasFlag(ReportPresentationOptions.ShowCriteria), PresentationOptions.HasFlag(ReportPresentationOptions.ShowQRCode) ); /* maybe some charts */ bool trendline = PresentationOptions.HasFlag(ReportPresentationOptions.Trendline); if (Presentation.HasFlag(ReportDefPresentations.Linechart)) { /* draw data into a line chart */ var line = RenderChart(ReportDefPresentations.Linechart); engine.SubmitChart(line); } if (Presentation.HasFlag(ReportDefPresentations.Barchart)) { /* draw data into a bar chart */ var bar = RenderChart(ReportDefPresentations.Barchart); engine.SubmitChart(bar); } if (Presentation.HasFlag(ReportDefPresentations.Piechart)) { /* draw data into a pie chart */ var pie = RenderChart(ReportDefPresentations.Piechart); engine.SubmitChart(pie); } /* maybe some tabular data */ if (Presentation.HasFlag(ReportDefPresentations.Crosstab)) { /* make a HTML crosstab out of the data */ //engine.SubmitCrosstab(AsCrosstab); } /* submit everything */ engine.SubmitToStream(this); } else { /* cannot render that... */ throw new NotSupportedException(Outputformat.ToString()); } /* succeeded */ return(true); } catch (Exception ex) { /* some error */ OnBuiltinReportError(ex.Message, ex); return(false); } }