Docx background Colour

4 posts, 0 answers
  1. Merokko
    Merokko avatar
    2 posts
    Member since:
    Aug 2010

    Posted 02 Mar 2011 Link to this post

    Hello,

    When I import a MS-Word document into a Rich Text Box, the background  of the document always turns white, irrespective of the colour it had in Word.  Is this a feature, or am I missing something?

    Thanks

    Merokko

  2. Felix De Lille
    Felix De Lille avatar
    18 posts
    Member since:
    Jun 2009

    Posted 02 Mar 2011 Link to this post

    I have exactly the same problem with importing a docx.
  3. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 04 Mar 2011 Link to this post

    Hi Merokko, Felix,

    We do not support different page colors of the document yet. If you are using RadRichTextBox in flow layout mode (the default one), you can set RadRichTextBox's Background and if you are using paged layout mode, you can change the template of the page like this:

    Copy Code
    <telerik:RadRichTextBox Name="editor" KeyDown="editor_KeyDown" KeyUp="editor_KeyUp" >
        <telerik:RadDocument LayoutMode="Paged" />
        <telerik:RadRichTextBox.Resources>
     
            <Style TargetType="telerikUI:Page">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="telerikUI:Page">
                            <Grid>
                                <Border Padding="0" BorderThickness="1" BorderBrush="#646464" Margin="-1" Background="Black" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                    <Border.Effect>
                                        <DropShadowEffect Color="#333333" ShadowDepth="6" BlurRadius="12" Opacity="0.7"/>
                                    </Border.Effect>
                                </Border>
                                <Canvas x:Name="PageContentPresenter" Background="LightGoldenrodYellow" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="VerticalAlignment" Value="Top" />
            </Style>
     
        </telerik:RadRichTextBox.Resources>
    </telerik:RadRichTextBox>

    where the namespaces are declared as follows:
    Copy Code
    xmlns:telerikUI="clr-namespace:Telerik.Windows.Documents.UI;assembly=Telerik.Windows.Documents">

    The import of Docx documents that have different page colors, however, will not work until page colors on the document are supported by the format provider. We will consider adding page background color to the document in one of the next releases.
    If you have other questions, do not hesitate to contact us again. Greetings,
    Iva
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  4. Merokko
    Merokko avatar
    2 posts
    Member since:
    Aug 2010

    Posted 04 Mar 2011 Link to this post

    Hello Iva,
    Thanks.  I can live with only one colour.

    Cheers
Back to Top