This question is locked. New answers and comments are not allowed.
I want to export a RadDocument with a HtmlFormatProvider. But my registered StyleDefinitions (which have a dedicated Name and DisplayName Property) "loose" their name in the export and replaced by something "random".
How can I change this behavior?
The reason is that we want to send the HTML to another system were the CSS-Names inherently contain processing information and we have to change (some, not all) generated CSS names to our requirement.
RadDocument document = RadRichTextBox.Document;<
br
>
<
br
>
StyleDefinition style = ...;<
br
>
style.Name = "MyStyleNameWhichIWantToSeeUsedInTheHtmlExport_AndNot_ARandomizedNumber");<
br
>
style.DisplayName = style.Name;<
br
>
<
br
>
document.StyleRepository.Add(style);<
br
>
<
br
>
RadDocument fragmentDocument = new RadDocument();<
br
>
Section section = new Section();<
br
>
Paragraph paragraph = new Paragraph();<
br
>
<
br
>
MergeField field = new MergeField();<
br
>
<
br
>
String propertyPath = "FunnyPropertyPath";<
br
>
<
br
>
field.PropertyPath = propertyPath;<
br
>
Span span = new Span("{MERGEFIELD " + propertyPath + "}");<
br
>
span.StyleName = style.Name;<
br
>
<
br
>
FieldRangeStart start = new FieldRangeStart();<
br
>
FieldRangeEnd end = new FieldRangeEnd();<
br
>
start.End = end;<
br
>
start.Field = field;<
br
>
<
br
>
paragraph.Inlines.Add(start);<
br
>
paragraph.Inlines.Add(span);<
br
>
<
br
>
paragraph.Inlines.Add(end);<
br
>
<
br
>
section.Blocks.Add(paragraph);<
br
>
fragmentDocument.Sections.Add(section);<
br
>
<
br
>
fragmentDocument.MeasureAndArrangeInDefaultSize();<
br
>
fragmentDocument.Selection.SelectAll();<
br
>
DocumentFragment fragment = fragmentDocument.Selection.CopySelectedDocumentElements();<
br
>
<
br
>
document.InsertFragment(fragment);<
br
>
<
br
>
HtmlFormatProvider htmlFormatProvider = new HtmlFormatProvider();<
br
>
htmlFormatProvider.ExportSettings = new HtmlExportSettings();<
br
>
htmlFormatProvider.ExportSettings.StylesExportMode = StylesExportMode.Classes;<
br
>
htmlFormatProvider.ExportSettings.ImageExportMode = ImageExportMode.Base64Encoded;<
br
>
htmlFormatProvider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Document;<
br
>
<
br
>
String htmlExportWithCssNamesWhichSeemToBeGeneratedWithSomeKindOfHash = htmlFormatProvider.Export(document);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
br
>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
><
br
>
<
head
><
br
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/><
br
>
<
title
>Untitled</
title
><
br
>
<
style
type
=
"text/css"
><
br
>
.<
b
>p_CC664AAA</
b
> {<
br
>
margin: 0px 0px 12px 0px;<
br
>
text-align: left;<
br
>
text-indent: 0pt;<
br
>
padding: 0px 0px 0px 0px;<
br
>
}<
br
>
<
br
>
.<
b
>s_E6FD204</
b
>6 {<
br
>
font-family: 'Verdana';<
br
>
font-style: Normal;<
br
>
font-weight: normal;<
br
>
font-size: 16px;<
br
>
color: #000000;<
br
>
}<
br
>
</
style
><
br
>
</
head
><
br
>
<
body
><
br
>
<
p
class="<b>p_CC664AAA</
b
>"><
br
>
<
span
class="<b>s_E6FD2046</
b
>">test { MERGEFIELD FunnyPropertyPath}Text</
span
><
br
>
</
p
><
br
>
</
body
><
br
>
</
html
><
br
>
How can I change this behavior?
The reason is that we want to send the HTML to another system were the CSS-Names inherently contain processing information and we have to change (some, not all) generated CSS names to our requirement.