FlowDocumentReader Arabic strings

I had a customer question about how to use FlowDocumentReader in WPF, for Arabic text. I thought this was a good opportunity to share with you this short sample.

This is a FlowDocumentReader that displays an Arabic FlowDocument. I included diacritics in the strings to make it more illustrative. To make sure that your document is displayed properly you need to set the language of the document. In my sample , I set the language to Arabic-Egypt. This will fix the display, beside setting the proper digit substitution or number substitution. But to make our scenario more complex, I decided to use European number substation , to make use of this ability. I set NumberSubstitution.Substitution="European", but in most cases I would leave the default behavior.

I hope you enjoy this sample:

<FlowDocumentReader FlowDirection="RightToLeft" Language="ar-EG" NumberSubstitution.Substitution="European"

Margin="10" BorderBrush="Gray" BorderThickness="2">

    <FlowDocument ColumnWidth="400" IsOptimalParagraphEnabled="True" IsHyphenationEnabled="True" >

        <Section FontSize="18">


                <Bold>اعلن</Bold> المسؤولون في وكالةِ الفضاءَ الامريكيةَ ناسا انْ اطلاقْ مكوكَ الفضاءَ انديفّور الغي بسبب تسرب للهيدروجين.

                <Figure Width="250" Height="50" Background="Bisque" HorizontalAnchor="PageLeft" HorizontalOffset="100" VerticalOffset="20">

                    <Paragraph FontStyle="Italic" Foreground="Green">

                        ناسا تُلغي اطِلاق مكّوك فضاء





                كان من المقرر اطلاق انديفور من قاعدة كيب كانيفرال وعلى متنه سبعة رواد فضاء في السابعة و17 دقيقة صباح اليوم بالتوقيت المحلي،

 لكن اطلاقه الغي قبل الموعد بساعات قليلة.





Comments (0)

Skip to main content