Exemplo n.º 1
0
        /// <summary>
        /// convert data to requested type
        /// </summary>
        /// <param name="xData">data</param>
        /// <param name="xConvertTypeID">type to convert to</param>
        /// <returns>string</returns>
        protected string Convert(DataTable xData, string xConvertType, bool xShowHeaders = false)
        {
            string exportData = String.Empty;

            switch (xConvertType)
            {
            case "CSV":
                exportData = DataConverter.ConvertToCSV(xData, xShowHeaders);
                break;

            case "HTML":
                HtmlConverter htmlConvert = new HtmlConverter();
                exportData = htmlConvert.Convert(xData);
                break;
            }
            return(exportData);
        }
        /// <summary>
        /// convert datatable to html
        /// </summary>
        /// <param name="xData">data</param>
        /// <returns>csv string</returns>
        public static string ConvertToHTML(DataTable xData)
        {
            HtmlConverter htmlConverter = new HtmlConverter();

            return(htmlConverter.Convert(xData));
        }