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

Provider issue with RadBook and RadRichTextPageView

2 Answers 131 Views
Book
This is a migrated thread and some comments may be shown as answers.
Jared
Top achievements
Rank 1
Jared asked on 17 Dec 2010, 08:13 PM
I'm trying to recreate the integration between the Rich Text Editor and the Radbook control as demonstrated Q3 for 2010 demos. However, when I get to this statement:


                IDocumentFormatProvider provider = DocumentFormatProvidersManager.GetProviderByExtension(extension);

                IDocumentFormatProvider provider = DocumentFormatProvidersManager.GetProviderByExtension(extension);

                IDocumentFormatProvider provider = DocumentFormatProvidersManager.GetProviderByExtension(extension);
IDocumentFormatProvider provider = DocumentFormatProvidersManager.GetProviderByExtension(".docx");

provider is always null. I've looked through the source code with the provided sample and everything is the same, but it just won't find the provider. Is there a step that I need to add to load the providers? or a way to find out which providers exist?

2 Answers, 1 is accepted

Sort by
0
Jared
Top achievements
Rank 1
answered on 17 Dec 2010, 08:40 PM
Ok, I got the providers to load but now the document isn't showing up. Based on the integration example, I have the following xaml:

<telerik2:DocumentViewManager x:Name="viewManager"></telerik2:DocumentViewManager>
<
DataTemplate x:Key="PageTemplate">
            <Grid Background="White">
                <telerik2:RadRichTextPageView HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    ViewManager="{Binding ElementName=viewManager}"
                    PageIndex="{Binding Path=PageIndex}"
                    >
                    <telerik2:RadRichTextPageView.RenderTransform>
                        <ScaleTransform ScaleX="0.7" ScaleY="0.7"></ScaleTransform>
                    </telerik2:RadRichTextPageView.RenderTransform>
                </telerik2:RadRichTextPageView>
                <TextBlock Height="30" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="9"
                    Foreground="#5B5B5B" Margin="0,0,0,5" Text="{Binding Path=PageIndexDisplay}" />
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="ContentTemplate">
            <Grid>
                <telerikNavigation:RadBook x:Name="book" Visibility="Collapsed" RightPageIndex="1"
                                           LeftPageTemplate="{StaticResource PageTemplate}" RightPageTemplate="{StaticResource PageTemplate}">
                </telerikNavigation:RadBook>
        </DataTemplate>

And the following code:

private void LoadDocument(System.ServiceModel.DomainServices.Client.InvokeOperation<byte[]> result)
{
    RadDocument doc;
    byte[] resultFinal;
    resultFinal = result.Value;
    byte[] empty = new byte[0];
        IDocumentFormatProvider provider = new DocxFormatProvider();
        if (provider != null)
        {
            doc = provider.Import(resultFinal);
        }
        else
        {
            MessageBox.Show("Unknown format.");
            return;
        }
 
        this.book.RightPageIndex = 0;
 
        this.viewManager.Document = doc;
        bindingSource.Document = doc;
 }

Any thoughts?
static Example()
        {
            ExamplesFormatProvidersManager.RegisterFormatProviders();
        }

        public Example()
        {
            InitializeComponent();
        }
static Example()
        {
            ExamplesFormatProvidersManager.RegisterFormatProviders();
        }

        public Example()
        {
            InitializeComponent();
        }
0
Jared
Top achievements
Rank 1
answered on 21 Dec 2010, 04:26 PM
Turns out I was missing this line:

book.ItemsSource = bindingSource;
Tags
Book
Asked by
Jared
Top achievements
Rank 1
Answers by
Jared
Top achievements
Rank 1
Share this question
or