This is a migrated thread and some comments may be shown as answers.

DataProviderBase, where has the ExportSettings property gone?

5 Answers 97 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Christophe
Top achievements
Rank 1
Christophe asked on 19 Oct 2011, 02:36 PM
Hello,

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

Sort by
0
Iva Toteva
Telerik team
answered on 21 Oct 2011, 02:26 PM
Hi Christophe,

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.

All the best,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Christophe
Top achievements
Rank 1
answered on 21 Oct 2011, 02:39 PM
Hello Iva,

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
0
Christophe
Top achievements
Rank 1
answered on 21 Oct 2011, 02:51 PM
Hi Iva,

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
0
Accepted
Iva Toteva
Telerik team
answered on 21 Oct 2011, 02:58 PM
Hi 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: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;
Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Christophe
Top achievements
Rank 1
answered on 21 Oct 2011, 03:08 PM
OK, thank you Iva !!
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
Tags
RichTextBox
Asked by
Christophe
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Christophe
Top achievements
Rank 1
Share this question
or