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

Docx background Colour

3 Answers 101 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Merokko
Top achievements
Rank 1
Merokko asked on 02 Mar 2011, 09:05 AM

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

3 Answers, 1 is accepted

Sort by
0
Felix De Lille
Top achievements
Rank 1
answered on 03 Mar 2011, 03:06 AM
I have exactly the same problem with importing a docx.
0
Iva Toteva
Telerik team
answered on 04 Mar 2011, 11:38 AM
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!
0
Merokko
Top achievements
Rank 1
answered on 04 Mar 2011, 11:57 AM
Hello Iva,
Thanks.  I can live with only one colour.

Cheers
Tags
RichTextBox
Asked by
Merokko
Top achievements
Rank 1
Answers by
Felix De Lille
Top achievements
Rank 1
Iva Toteva
Telerik team
Merokko
Top achievements
Rank 1
Share this question
or