public void Vizualize([NotNull] HtmlTextWriter htmlTextWriter, [NotNull] ImageReportBlock block, IReadOnlyDictionary <string, object> parameterValues, IReadOnlyCollection <ReportQueryResult> queryResults, long userId) { if (htmlTextWriter == null) { throw new ArgumentNullException(nameof(htmlTextWriter)); } if (block == null) { throw new ArgumentNullException(nameof(block)); } var imgStyle = new HtmlStyle(); imgStyle .Set(HtmlStyleKey.Width, _htmlEncoder.Encode(block.Width)) .Set(HtmlStyleKey.Height, _htmlEncoder.Encode(block.Height)); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Alt, block.Alt); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Src, block.Source); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Style, imgStyle.ToString()); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Id, block.Id); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Img); htmlTextWriter.RenderEndTag(); }
public void Text(FormDataSetEntry entry, String value) { if (entry.HasName && value != null) { _writers.Add(stream => { stream.WriteLine("Content-Disposition: form-data; name=\"{0}\"", _htmlEncoder.Encode(entry.Name, _encoding)); stream.WriteLine(); stream.WriteLine(_htmlEncoder.Encode(value, _encoding)); }); } }
public void Vizualize([NotNull] HtmlTextWriter htmlTextWriter, [NotNull] LinkReportBlock block, IReadOnlyDictionary <string, object> parameterValues, IReadOnlyCollection <ReportQueryResult> queryResults, long userId) { if (htmlTextWriter == null) { throw new ArgumentNullException(nameof(htmlTextWriter)); } if (block == null) { throw new ArgumentNullException(nameof(block)); } if (block.Target == null) { throw new EmptyLinkReportBlockTargetException(block.Id); } if (block.Child == null) { throw new EmptyLinkReportBlockChildException(block.Id); } var template = _templateBuilder.Build(block.Target); if (parameterValues != null) { foreach (var parameterValue in parameterValues) { template.Add(parameterValue.Key, parameterValue.Value); } } var renderedTemplate = template.Render(); renderedTemplate = _htmlEncoder.Encode(renderedTemplate); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Href, renderedTemplate); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.A); _blockVizualizationManager.Vizualize( htmlTextWriter, (dynamic)block.Child, parameterValues, queryResults, userId); htmlTextWriter.RenderEndTag(); }
public void Vizualize( [NotNull] HtmlTextWriter htmlTextWriter, [NotNull] LabelReportBlock block, IReadOnlyDictionary <string, object> parameterValues, IReadOnlyCollection <ReportQueryResult> queryResults, long userId) { if (htmlTextWriter == null) { throw new ArgumentNullException(nameof(htmlTextWriter)); } if (block == null) { throw new ArgumentNullException(nameof(block)); } var labelStyle = new HtmlStyle(); labelStyle .Set(HtmlStyleKey.Display, "inline-block") .Set("word-break", "break-all") .Set("white-space", "pre-wrap") .Set("word-wrap", "break-word") .Set(HtmlStyleKey.Color, block.Color.ToRgb()) .Set(HtmlStyleKey.FontFamily, block.FontStyle.FontFamily) .Set(HtmlStyleKey.FontStyle, block.FontStyle.Italic ? "italic" : "normal") .Set(HtmlStyleKey.FontSize, $"{block.FontStyle.FontSizePx}px") .Set(HtmlStyleKey.FontWeight, block.FontStyle.Bold ? "bold" : "normal") .Set(HtmlStyleKey.TextAlign, block.HorizontalAlign.ToString()) .Set(HtmlStyleKey.VerticalAlign, block.VerticalAlign.ToString()) .Set(HtmlStyleKey.Width, "100%"); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Style, labelStyle.ToString()); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Id, block.Id); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Label); if (!string.IsNullOrEmpty(block.Text)) { var renderedTemplate = RenderTemplate(block, parameterValues); renderedTemplate = _htmlEncoder.Encode(renderedTemplate); htmlTextWriter.Write(renderedTemplate); } htmlTextWriter.RenderEndTag(); // label }