[DevExpress Support Team: CLONED FROM DS55840: XRControl - Add the RightToLeft property to all text aware controls]
Does the rtl Report implementation include mixed RTL & LTR text?
If not can you give instructions on how to implement?
Thank you.
Dov
How to include mixed RTL & LTR text to Report
Answers approved by DevExpress Support
Hi Dov,
We implemented RTL support for our components starting with version 16.1 (see the original XRControl - Add the RightToLeft property to all text aware controls thread). The mixed RTL and LTR text is also supported starting with version 16.1.
In any case, from your account, I see that v16.1 is not available to you. So, to use the newly introduced RTL text drawing functionality, you need to renew our components license and use version 16.1 or newer.
Hi Dov,
-
Solutions and projects are merely a way to structure and organize your code. What I mean here is the following: "If you have a .NET executable, not matter what kind is it, that loads DevExpress DLLs intro its address space, all those DLLs must be of the same version. Otherwise, certain runtime issues can be expected." So, if you're thinking like "I have just one ASP.NET application that processes all incoming requests. I can't add reports directly to this project, so I will create a separate Class Library. There, I'll create reports of a different DevExpress version and then reference this assembly by my main application", - that's not going to work. At the same time, two ASP.NET applications running side-by-side with some iFrame embedding is a valid workaround.
-
It will display bidirectional text, but I can't say that it will display it the exact way you want it or your end-users want it. As you probably know, our reporting tools are based on the Windows text rendering engine (the System.Drawing namespace), and for this reason we can't overcome platform constraints. The bidirectional algorithm implementation depends on your OS version and the script (language) that you're using. However, even if the system does its job right, it's likely possible that the result does not reflect the user's intent. This MSDN article explains the "why" part in more detail here: Right-to-left language support and bidirectional text. For example, this StackOverflow example does work correctly according to the specified Bidi rules (numbers are "weak" so they are also RTL), but it's unlike what the user wants, and that's where you have to be explicit.
So, my point here is that the new DevExpress version my colleague mentioned at the very beginning of this conversation talks about "mirroring" the UI, it does not introduce anything in terms of bidirectional drawing (we don't handle that at all). If you're interested in how your text would look like in the latest XtraReports version with the enabled RTL support (no explicit directional formatting), you can easily do that by creating a WinForms project and drawing this text in the Form's Paint event handler as follows:
C#private void Form1_Paint(object sender, PaintEventArgs e) {
e.Graphics.DrawString(myBidiString, this.Font, Brushes.Black, new RectangleF(0,0, 300, 300), new StringFormat(StringFormatFlags.DirectionRightToLeft));
}
Drop me a line in case of any follow-up questions.
Regards,
Yaroslav
Hello Yaroslav,
Thank you very much!
Your clarifications and links are very helpful!
By the way I made changes in the code in the XtraReports RTL: bidirectional text drawing article in the code in Nir's comment.
Instead of:
C#sb.Insert(m.Index, LRM);
sb.Insert(m.Index + m.Value.Length + 3, RLM);
I wrote:
C#string mTrim = m.Value.Trim();
sb.Replace(m.Value, " " + LRM + mTrim + " " + RLM);
This gets the text in proper order and also places spaces between RTL and LTR texts properly.
It can be seen here Misplaced spaces between RTL and LTR strings.
Once again thank you very much for your help and attention!
Dov
You're welcome, Dov! I've updated Nir's original solution based on your correction. I hope it will be useful for someone else who may be running into the same issue of bidirectional text drawing.
Should further questions arise, feel free to contact us at any time.
Regards,
Yaroslva