示例#1
0
        /// <summary>
        /// Returns <see cref="IRowObject"/> as an HTML string with or without HTML headers.
        /// </summary>
        /// <param name="rowObject"></param>
        /// <param name="includeHtmlHeaders"></param>
        /// <returns></returns>
        public static string TransformToHtmlString(IRowObject rowObject, bool includeHtmlHeaders)
        {
            if (rowObject == null)
            {
                throw new ArgumentNullException("Parameter cannot be null.", "rowObject");
            }
            string html = "";

            html += includeHtmlHeaders ? GetHtmlHeader() : "";
            html += GetPageHeader(rowObject.GetType().ToString());
            html += GetHtmlForObject(rowObject, HtmlOutputType.Table);
            if (rowObject.Fields != null)
            {
                html += "<h2>Fields</h2>";
                html += "<table>";
                html += GetHtmlForObject(rowObject.Fields.FirstOrDefault(), HtmlOutputType.TableHeaders);
                foreach (FieldObject fieldObject in rowObject.Fields)
                {
                    html += GetHtmlForObject(fieldObject, HtmlOutputType.TableRow);
                }
                html += "</table>";
            }
            html += includeHtmlHeaders ? GetHtmlFooter() : "";
            return(html);
        }
示例#2
0
        /// <summary>
        /// Returns <see cref="IRowObject"/> as an HTML string with or without HTML headers.
        /// </summary>
        /// <param name="rowObject"></param>
        /// <param name="includeHtmlHeaders"></param>
        /// <returns></returns>
        public static string TransformToHtmlString(IRowObject rowObject, bool includeHtmlHeaders)
        {
            if (rowObject == null)
            {
                throw new ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
            }
            StringBuilder sb = new StringBuilder();

            sb.Append(GetHeader(rowObject.GetType().ToString(), includeHtmlHeaders));
            sb.Append(GetHtmlForObject(rowObject, HtmlOutputType.Table));
            sb.Append(AddFieldsTable(rowObject, 2));
            sb.Append(GetFooter(includeHtmlHeaders));
            return(sb.ToString());
        }