I've read through various articles in this forum but am still struggling to get clean HTML output from the RichTextBox/HtmlDataProvider.
It seems to try and be very explicit in the markup it creates, whereas actually what we need is clean, uncluttered HTML where CSS classes are only used when a style is specifically set, thus allowing other elements to inherit styles from the page their inserted into.
For example, a few lines of text and a few bullet points produces this:
What we really need is something like this:
This is an extreme example as we will want to be using other formatting, but the principle's there - we're looking to pass the HTML through an HTML templating system and the specific styles being applied are causing issues. We're not looking for anything too complex, but need to know the output is going to be flexible enough to be influenced by higher level CSS and render predictably in a browser/email client.
Is there any way to achieve this kind of clean output without writing our own custom DocumentFormatProvider?
Any help would be very much appreciated as we've been grappling with this for a long time.
Many thanks,
Chris
It seems to try and be very explicit in the markup it creates, whereas actually what we need is clean, uncluttered HTML where CSS classes are only used when a style is specifically set, thus allowing other elements to inherit styles from the page their inserted into.
For example, a few lines of text and a few bullet points produces this:
<
style
type
=
"text/css"
>
.p_CC664AAA { margin: 0px 0px 12px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; }
.s_1C757C00 { font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 13.3299999237061px;color: #000000; }
</
style
>
<
p
class
=
"p_CC664AAA"
><
span
class
=
"s_1C757C00"
>This is a line of text.</
span
></
p
>
<
p
class
=
"p_CC664AAA"
><
span
class
=
"s_1C757C00"
>This is a new para.</
span
></
p
>
<
ul
style
=
"list-style-type:disc"
>
<
li
value
=
"1"
class
=
"p_CC664AAA"
><
span
class
=
"s_1C757C00"
>First bullet</
span
></
li
>
<
li
value
=
"2"
class
=
"p_CC664AAA"
><
span
class
=
"s_1C757C00"
>Second bullet</
span
></
li
>
</
ul
>
<
p
class
=
"p_CC664AAA"
><
span
class
=
"s_1C757C00"
>The end.</
span
></
p
>
What we really need is something like this:
<
p
>This is a line of text.</
p
>
<
p
>This is a new para.</
p
>
<
ul
>
<
li
>First bullet</
li
>
<
li
>Second bullet</
li
>
</
ul
>
<
p
>The end.</
p
>
This is an extreme example as we will want to be using other formatting, but the principle's there - we're looking to pass the HTML through an HTML templating system and the specific styles being applied are causing issues. We're not looking for anything too complex, but need to know the output is going to be flexible enough to be influenced by higher level CSS and render predictably in a browser/email client.
Is there any way to achieve this kind of clean output without writing our own custom DocumentFormatProvider?
Any help would be very much appreciated as we've been grappling with this for a long time.
Many thanks,
Chris