I am loading a raddocument from docx by import:
but it is clipped on the right side. Only 6.5 inches of the document is being shown (not 8.5 inches).
<telerik:RadRichTextBoxRibbonUI Visibility="Collapsed" Grid.Column="1" ApplicationButtonImageSource="/RichTextBox;component/Images/RichTextBox/MSOffice/AppIcon-telerik.png" DataContext="{Binding Path=Commands, ElementName=editor}" Name="radRichTextBoxRibbonUI">
...
</telerik:RadRichTextBoxRibbonUI>
<telerik:RadRichTextBox Visibility="Collapsed" Grid.Row="1" x:Name="editor" Margin="24 24 0 0" AllowDrop="True" Drop="editor_Drop" ShowComments="True" IsSpellCheckingEnabled="False" LayoutMode="Flow" />
<telerik:DocumentRuler x:Name="ruler" AssociatedRichTextBox="{Binding ElementName=editor, Mode=OneTime}" Grid.Row="1" />
<telerik:RadRichTextBoxStatusBar Grid.Row="2" AssociatedRichTextBox="{Binding ElementName=editor, Mode=OneTime}"/>
public void ImportDocument(byte[] data)
{
this.editor.Document = GetDocumentFromDocx(data);
//this.editor.Document.Measure(RadDocument.MAX_DOCUMENT_SIZE);
//this.editor.Document.Arrange(new RectangleF(PointF.Empty, this.editor.Document.DesiredSize));
this.editor.Document.LayoutMode = DocumentLayoutMode.Paged;
//this.editor.Document.DefaultPageLayoutSettings.Width = 320 / 0.7F;
//this.editor.Document.DefaultPageLayoutSettings.Height = 390 / 0.7F;
//this.editor.Document.SectionDefaultPageMargin = new Padding(55);
//this.editor.Document.Sections.First.PageMargin = new Padding(55);
this.editor.Document.UpdateLayout();
}
private static RadDocument GetDocumentFromDocx(byte[] docx)
{
RadDocument result;
if (docx == null || docx.Length == 0)
{
result = new RadDocument();
}
else
{
IDocumentFormatProvider provider = new DocxFormatProvider();
result = provider.Import(docx);
}
return result;
}