Ticket T509067
Visible to All Users

Arabic text doesn't display the correct order

created 8 years ago (modified 8 years ago)

hi we have a problem with the Arabic text displaying. basically we subscribe to Arabic rss feed @https://arabic.cnn.com/rss

here is a snippet of the feed:
<item> <title>مسؤول كوري شمالي لـCNN: لن نوقف التجارب النووية والصاروخية</title> <link>https://arabic.cnn.com/world/2017/04/27/wd-250417-north-korea-dprk-official-interview</link&gt; <description>يجري الجيش الكوري الشمالي ما وصفه بأنه &quot;أكبر تدريب عسكري&quot;. </description> <pubDate>Thu, 27 Apr 2017 08:41:18 +0000</pubDate> <dc:creator>nshalalda</dc:creator> <guid isPermaLink="false">107711 at https://arabic.cnn.com</guid&gt; </item> as you see the highlighted <title> node, this is what we wanted to display in the grid text. note that if you put the following text in WORD:
<title>مسؤول كوري شمالي لـCNN: لن نوقف التجارب النووية والصاروخية</title>

and click on text direction button: you get the following result
مسؤول كوري شمالي لـCNN: لن نوقف التجارب النووية والصاروخية</title>

note that it moved the text to the right and the order of the text had been altered.

back to the DevExpress grid control, I added the following in the CustomDrawCell function trying t o achieve the same effect:
e.Appearance.TextOptions.RightToLeft = true;

unfortunately it's not doing anything, it's not even align the text to the right.

i have to add the following so the text align to the right:
e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;

but the text order is wrong and the following is displayed (the same as the raw feed):
<title> مسؤول كوري شمالي لـCNN: لن نوقف التجارب النووية والصاروخية</title>

I know there are lots of things going on on your end regarding RTL in recent years, can I get an update on if the control support displaying Arabic text? or did I do something wrong?

thanks
Jia

UPDATE: in the editor the text showed up the correct order but as soon as i click on Submit button the text messed up so there's even a bug here :)

anyways, I have made a screenshot of what the text supposed to look like. see attachment,

Show previous comments (1)
Sasha (DevExpress Support) 8 years ago

    Hello Jia,
    Before providing you with a solution, I wish to clarify your task. Do you wish to paint the Grid in the right-to-left direction or only the text in a specific cell? Generally, it is possible to enable RTL using the RightToLeft property.
    When this property is set to DefaultBoolean.True text in the Grid is painted in correct direction.

    UPDATE: in the editor the text showed up the correct order but as soon as i click on Submit button the text messed up so there's even a bug here :)
    I've created a separate ticket on your behalf regarding this problem: Arabic text order is changed when a ticket's data is submitted. Our team will address it as soon as possible.

      hi Sasha,
      thanks for the reply.
      since it's Arabic, we want to show it the right way Arabic people read. so in this case we need to make sure the following 2:

      1. the text need to align to the right
      2. the text need to show up the correct order.

      so what we need is the text in the cells should show up as expected.

      I agree with you, and I tried to set the RightToLeft property: e.Appearance.TextOptions.RightToLeft = true; but it seems not doing the job.

      regarding the DefaultBoolean.True , can you explain a bit more? I don't see how it can be applied here…

      thanks
      Jia

        and FYI this grid is used in a multi-language environment meaning not all the rows are Arabic. so some of them will be LTR and some will be RTL. this is why we are trying to manipulate the text in the
        CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)

        function. here I located the e.Appearance.TextOptions.RightToLeft property and this takes a Boolean instead of DefaultBoolean.

        Answers approved by DevExpress Support

        created 8 years ago

        Hello Jia,

        I mean the  WindowsFormsSettings.RightToLeft property. The type of this property is DefaultBoolean. In any case, as you need to set right-to-left mode for a single grid cell, the WindowsFormsSettings.RightToLeft property won't be helpful (this property changes the layout of the whole application).
        According to the Setting right-to-left mode for a single grid cell ticket, the capability of setting the Right To Left layout for a particular column or cell is not supported. The only possible solution is to draw a text in the Right To Left layout manually by using standard methods of the Graphics class. Please review the .net - Printing Right-To-Left in c# - Stack Overflow article, where the issue with drawing text in the RTL mode is discussed.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.