The Following function will return a HTML formatted string for the given dataset. Some line are commented, you can remove comments if you need. CODE: DataTable dtPriceDetails = SOME DATA TABLE if (dt.Rows.Count > 0) { string StringDataTable = ConvertToHtmlFile(dtPriceDetails); } public static string ConvertToHtmlFile(DataTable targetTable) { string myHtmlFile = "" ; if (targetTable == null ) { throw new System.ArgumentNullException( "targetTable" ); } else ...