Provider issue with RadBook and RadRichTextPageView

3 posts, 0 answers
  1. Jared
    Jared avatar
    3 posts
    Member since:
    Dec 2010

    Posted 17 Dec 2010 Link to this post

    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. Jared
    Jared avatar
    3 posts
    Member since:
    Dec 2010

    Posted 17 Dec 2010 Link to this post

    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();
            }
  3. DevCraft banner
  4. Jared
    Jared avatar
    3 posts
    Member since:
    Dec 2010

    Posted 21 Dec 2010 Link to this post

    Turns out I was missing this line:

    book.ItemsSource = bindingSource;
Back to Top