Pho3nix
The Legend
As the title states, is it possible ? Any code for it. Been googling and can't find a thing, only .html to .xhtml or string to integer.
Any help would be appreciated
Any help would be appreciated
South Africa’s biggest forum. Discuss, discover, and connect with thousands of members.
Coding some InfoPath forms and it seems some fields are RichText Boxes of data type .xhtml and need to convert it to a string for use in a adjoining table that data will be exported to..Alota fields and wondered if there was an easier way to do this instead of removing all the fields and replacing them with text boxes.
EDIT : Oopsmeant how would you convert a .xhtml to a string.
I think he wants to strip out all HTML formatting from the text and have clean paragraph-like text to insert into the database.
public class HtmlRemoval
{
public static string StripTagsRegex(string source)
{
return Regex.Replace(source, "<.*?>", string.Empty);
}
static Regex _htmlRegex = new Regex("<.*?>", RegexOptions.Compiled);
public static string StripTagsRegexCompiled(string source)
{
return _htmlRegex.Replace(source, string.Empty);
}
public static string StripTagsCharArray(string source)
{
char[] array = new char[source.Length];
int arrayIndex = 0;
bool inside = false;
for (int i = 0; i < source.Length; i++)
{
char let = source[i];
if (let == '<')
{
inside = true;
continue;
}
if (let == '>')
{
inside = false;
continue;
}
if (!inside)
{
array[arrayIndex] = let;
arrayIndex++;
}
}
return new string(array, 0, arrayIndex);
}
}
RichText Boxes of data type .xhtm