I'm trying to use the
HtmlFormatProvider
as described here and here.But in the latest build (2011.2.920.1040) there's no trace of the ExportSettings property in the DataProviderBase base class. Have I missed something? I need this to use the inline style export options...
Thank you,
Christophe
5 Answers, 1 is accepted
The DataProviderBase class does not have import and export settings, as not all format providers that inherit it offer such customization options.
The format providers that have import and export settings are HTML, RTF and PDF and you can customize them as shown here. In your case, perhaps a cast to HtmlFormatProvider will suffice to get the functionality working.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thank you for your answer, but in fact I am using an HtmlDataProvider. I just mentionned the DataProviderBase because it seems that the ExportSettings property is defined at this stage.
Am I missing a reference or something? Here is what I referenced:
- Telerik.Windows.Controls.dll
- Telerik.Windows.Controls.Input.dll
- Telerik.Windows.Controls.Navigation.dll
- Telerik.Windows.Controls.RibbonBar.dll
- Telerik.Windows.Controls.RichTextBoxUI.dll
- Telerik.Windows.Data.dll
- Telerik.Windows.Documents.dll
- Telerik.Windows.Documents.FormatProviders.Html.dll
Christophe
What is also weird, is that there is no mention anymore in the documentation about the ExportSettings property: neither in HtmlDataProvider nor DataProviderBase base class.
Christophe
You have added all required assembly references.
The ExportSettings and ImportSettings are properties of the format provider (HtmlFormatProvider, RtfFormatProvider and PdfFormatProvider). The data providers are built around an instance of the respective format provider and use it to export the document in order to update the property they are bound to and vice versa - import the value of the property to update the document. Therefore, you need to get a hold of the HtmlFormatProvider that the data provider keeps as a property and apply the settings to it.
In XAML this can be done as follows:
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikHtml="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"
xmlns:telerikHtmlInDocuments="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents"
***
<
telerik:RadRichTextBox
x:Name
=
"richTextBox"
/>
<
telerikHtml:HtmlDataProvider
RichTextBox
=
"{Binding ElementName=richTextBox}"
Html
=
"{Binding Path=HtmlText}"
>
<
telerikHtml:HtmlDataProvider.FormatProvider
>
<
telerikHtml:HtmlFormatProvider
>
<
telerikHtml:HtmlFormatProvider.ExportSettings
>
<
telerikHtmlInDocuments:HtmlExportSettings
StylesExportMode
=
"Inline"
/>
</
telerikHtml:HtmlFormatProvider.ExportSettings
>
</
telerikHtml:HtmlFormatProvider
>
</
telerikHtml:HtmlDataProvider.FormatProvider
>
</
telerikHtml:telerikHtml:HtmlDataProvider
>
If you are using code behind:
HtmlFormatProvider provider =
this
.htmlDataProvider.FormatProvider
as
HtmlFormatProvider ;
HtmlExportSettings settings =
new
HtmlExportSettings();
settings.StylesExportMode = StylesExportMode.Inline;
provider.ExportSettings = settings;
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
It was my fault, I was looking on the HtmlDataProvider instead of the HtmlFormatProvider for the property (as the names are very close).
I'm really sorry.
Thanks a lot again,
Christophe