コード例 #1
0
        internal void UpdateTextContent()
        {
            var content = templateContent;

            content = content.Replace("{foreground}", HtmlForeground.ToHtml());
            content = content.Replace("{link_foreground}", LinkForeground.ToHtml());
            content = content.Replace("{font_family}", HtmlFontFamily.ToString());
            content = content.Replace("{font_size}", HtmlFontSize.ToString());
            Text    = content.Replace("{text}", HtmlText?.ToString());
        }
コード例 #2
0
        public static string HtmlGenerator(string htmlTextWithoutHtmlBodyTags, HtmlFontColor fontColorValue = HtmlFontColor.Black, HtmlFontWeight fontWeightValue = HtmlFontWeight.Normal, HtmlFontSize fontSizeEnum = HtmlFontSize.inherit)
        {
            string        _fontSize = fontSizeEnum.ToString().Replace('_', '-');
            StringBuilder sb        = new StringBuilder();

            sb.Append("<html><body style='text-align:center'>");
            sb.Append($"<div style='color:{fontColorValue.ToString().ToLower()};font-weight:{fontWeightValue.ToString().ToLower()};font-size:{_fontSize};padding: 20px 20px 20px 20px; margin: 20px 20px 20px 20px'>");
            sb.Append(htmlTextWithoutHtmlBodyTags);
            sb.Append("</div></body></html>");
            return(sb.ToString());
        }
コード例 #3
0
        internal void UpdateTextContent()
        {
            var content = string.Empty;

            if (!string.IsNullOrEmpty(templateContent))
            {
                content = templateContent;
            }
            else if (HtmlText?.Contains("<html>") != true)
            {
                content = defaultTemplate;
            }

            content = content.Replace("{foreground}", ColorToHtml(HtmlForeground));
            content = content.Replace("{link_foreground}", ColorToHtml(LinkForeground));
            content = content.Replace("{font_family}", HtmlFontFamily.ToString());
            content = content.Replace("{font_size}", HtmlFontSize.ToString());
            Text    = content.Replace("{text}", HtmlText?.ToString());
        }