Question : I want to convert SQL field from HTML to Text

I have an Microsoft SQL server with a table that one of it's fields is HTML.
I need a way to convert it all to plain text

Answer : I want to convert SQL field from HTML to Text

I found a way
I wrote C## program that takes goes over the Table and strip from the field the HTML and make TXT out of it
It also replaces page break with Char(10) so I can use it in single line solutions
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
public string StripHTMLB(string htmlString, string htmlPlaceHolder)
        {
            if (htmlString.Length == 0)
                return htmlString;
            if (htmlString.Length > 5 && htmlString.Substring(htmlString.Length - 6, 6) == "", stNewLine);
            htmlString = htmlString.Replace("
", stNewLine); htmlString = htmlString.Replace("
", stNewLine); htmlString = htmlString.Replace(((char)13).ToString(), stNewLine); htmlString = htmlString.Replace(stNewLine + stNewLine, stNewLine); htmlString = htmlString.Replace(",", "."); htmlString = htmlString.Replace("&", "&"); htmlString = htmlString.Replace(""", "\""); htmlString = htmlString.Replace("'", "'"); htmlString = htmlString.Replace("(", "("); htmlString = htmlString.Replace(")", ")"); htmlString = htmlString.Replace(" ", stNewLine); htmlString = htmlString.Replace(" ", ""); htmlString = htmlString.Replace(">", ">"); htmlString = htmlString.Replace("<", "<"); htmlString = htmlString.Replace(stNewLine, "{*}"); string pattern = @"<[styleSTYLE]+(.)*?"; htmlString = Regex.Replace(htmlString, pattern, htmlPlaceHolder); pattern = @"<[headHEAD]+(.)*?"; htmlString = Regex.Replace(htmlString, pattern, htmlPlaceHolder); pattern = @"<(.)*?>"; htmlString = Regex.Replace(htmlString, pattern, htmlPlaceHolder); htmlString = htmlString.Replace("{*}", stNewLine); htmlString = htmlString.Replace("\"", "'"); while (htmlString.Length > 0 && htmlString.Substring(0, 1) == "\n") { htmlString = htmlString.Substring(1,htmlString.Length -1); } return htmlString; }
Random Solutions  
 
programming4us programming4us