Class HtmlToXamlConverter
A class that takes an HTML (Hypertext Markup Language) string and converts it into XAML (Extensible Application Markup Language).
Inherited Members
Namespace: MarkupConverter
Assembly: Aruba.Utilities.MarkupConverter.dll
Syntax
public static class HtmlToXamlConverter
Methods
View SourceAddNbspToEmptyParagraphs(HtmlDocument)
Adds non-breaking space to empty paragraphs in a provided html document.
Declaration
public static void AddNbspToEmptyParagraphs(HtmlDocument htmlDoc)
Parameters
Type | Name | Description |
---|---|---|
HtmlDocument | htmlDoc | The html document. |
AddNbspToEmptyParagraphs(string)
Adds non-breaking space to empty paragraphs
Declaration
public static string AddNbspToEmptyParagraphs(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | Text containing empty paragraphs. |
Returns
Type | Description |
---|---|
string | Text with empty paragraphs filled with a non-breaking space. |
ConvertHtmlToXaml(string, bool)
Converts an html string into xaml string.
Declaration
public static string ConvertHtmlToXaml(string htmlString, bool asFlowDocument)
Parameters
Type | Name | Description |
---|---|---|
string | htmlString | Input html which may be badly formated xml. |
bool | asFlowDocument | true indicates that we need a FlowDocument as a root element; false means that Section or Span elements will be used depending on StartFragment/EndFragment comments locations. |
Returns
Type | Description |
---|---|
string | Well-formed xml representing XAML equivalent for the input html string. |
FormatLineSpacing(HtmlDocument)
Formats line spacing for a provided html document.
Declaration
public static void FormatLineSpacing(HtmlDocument htmlDoc)
Parameters
Type | Name | Description |
---|---|---|
HtmlDocument | htmlDoc | The html document. |
GetAttribute(XmlElement, string)
Returns a value for an attribute by its name (ignoring casing)
Declaration
public static string GetAttribute(XmlElement element, string attributeName)
Parameters
Type | Name | Description |
---|---|---|
XmlElement | element | XmlElement in which we are trying to find the specified attribute |
string | attributeName | String representing the attribute name to be searched for |
Returns
Type | Description |
---|---|
string | value of the attribute if found, null otherwise |
NewLinesToParagraphs(string)
Converts newline characters to paragraph tags.
Declaration
public static string NewLinesToParagraphs(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | Text containing newline characters. |
Returns
Type | Description |
---|---|
string | Text with newline characters replaced by html paragraph tags. |