Candidate Names are changed in Arabic format [ RTL word format ]

Hi Alexey,

Thanks for your constant support & quick replies.

I am using Aspose.Word version 9.0.0.0 & i am facing problem while printing a word document in Arabic format[RTL].

We are printing the names of the candidate in an word document. but the names are not appearing in the report in proper format & order. [ Please refer the Actaul_Name.PNG && Problem_stmt.doc for further reference ].

All names in report are coming in proper format except the one name “Paul Sample” marked by Yellow background in word report.

If we print the same report in HTML format the names are appearing in correct format.[please refer the sample.txt [ convert it to HTML format since there is no facility to add HTML file to this forum]

We are using BIDI property for setting RTL in report.

Will you please look into this ASAP & send us the proper reply.

Waiting for you reply…!!!

Thanks & Regards,
Dwarika.

Hi Dwarika,

Thanks for your request. The problem occurs because you set Bidi property for LRT text. For LTR text this option should be disabled. In this case, your test will look as expected.
Best regards,

Hello Alexey,

Thanks for your reply.
I think the problem statement is not still clear to you.
While creating reports in Arabic language which uses Bidi to set the direction of the entire document, some of the text like one I have explained you in my earlier post changes the sequence “Paul Sample” becomes “Sample Paul”. Though this is not the case with other candidate names.
Take a look at Problem_stmt.doc attached with the original post for more details.
We have following queries related to RTL implementation,

  1. As we have saved intermediate HTML which shows the names correctly, is there any issue with RTL rendering when contents are rendered using Bidi = True?
  2. Are there any known issues with Word rendering related to RTL.

Do let us know answers for the above queries.
Regards,
Dwarika

Hi Dwarika,

Thank you for additional information. But still, I am absolutely sure that Bidi property must be set to false when you insert LTR(Left-To-Right) text into the document, like in your case.

  1. HTML shows names correctly because Aspose.Words does not support RTL(Right-To-Left) upon HTML import/export. I already mentioned this in another thread you created.
  2. In your case, your document does not contain RTL text at all. So you should disable Bidi property. In this case your text will be displayed properly.

Best regards,

Hello Alexy,

Thanks for your reply.
If you could post yes/ no answer to below queries then it will become easy for us to explain this issue to our client.

  1. Bidi property should be used when a report document contains text / content in RTL language. Here we are talking about language Arabic. Is this true?
  2. Bidi property should be disabled to render non RTL text / content. Here we are talking about the language other than Arabic like for e.g. English / Polish / Chinese. Is it true?
  3. When Bidi property is set to True for entire report document, then the report document should contain text / content in Arabic through out the document. Is it true?
  4. If Bidi property is set to True for entire report document and if the document contains mix text / language e.g. some text in Arabic and some text in English / Polish / Chinese then the report document may not render the text in correct format. Sequence of the letters / words may change for non-RTL content. Is it true?

Regards,
Dwarika

Hi Dwarika,

Thanks for your request. This is simple Boolean property, so logic is quite simple: if you insert RTL text option should be true, if you insert LTR text option should false.

  1. Yes, Bidi property should be set if you insert RTL text:
    https://reference.aspose.com/words/net/aspose.words/font/bidi/
  2. Yes, for LTR text Bidi property should be false.
  3. Not actually, document can contain both RTL and LTR text, but in this case Runs with RTL text should have Bidi property set to true, and Runs with LTR text should have Bidi property set to false.
  4. I already answered this in #3.

Best regards,

Hello Alexey,

Thanks very much for your reply and point wise answers to our queries.
Still I have some more queries on this, and “Query.doc” is attached with this post for your consideration.
Do let us know whether you have understood our concern now?
If there is any way by using which we can display non-RTL text as it is in a RTL report?
There are likely chances of having mix content when report is generated by using Bidi=“True”. This is because sometimes we do not have proper translation in Arabic and we display English text as it is. E.g. Web URL: www.shl.com
We know and also agree that you have stated in the reply that to display RTL content set Bidi=“True” and to display LTR content set Bidi=“False” for mixed language content.
But what we would like to know is: is there any way by which we can display mixed text, non-RTL and RTL in their respective correct format by setting Bidi=“True”
Is there any workaround by which we can achieve this?
I hope you have understood my point.
The original documents in English and Arabic reports are attached with this post.
Regards,
Dwarika

Hi Dwarika,

Thanks for your reqeust. You can easily insert mixed content into the document using code like the following:

DocumentBuilder builder = new DocumentBuilder();
// Insert RTL text.
builder.Font.Bidi = true;
// Specify the font and font size to be used for the right-to-left text.
builder.Font.NameBi = "Andalus";
// Specify the locale so Microsoft Word recognizes this text as Arabic - Saudi Arabia.
// For the list of locale identifiers see http://www.microsoft.com/globaldev/reference/lcid-all.mspx
builder.Font.LocaleIdBi = 1025;
// Insert some Arabic text.
builder.Write("مرحبًا");
// Insert LTR text.
builder.Font.Bidi = false;
builder.Write("Hello world");
// Again insert RTL text.
builder.Font.Bidi = true;
builder.Write("مرحبًا");
// Save output document.
builder.Document.Save(@"Test001\out.doc");

There should not be any problems here.
Best regards.

Hi Alexey,

Thank you for your quick reply & suggestion.

With reference to your sample code, it seems we have to explicitly bifurcate between RTL & LTR text before hand & then set the font property as per the type of text {Arabic & non-Arabic} .

But in our case this entire text is coming from user & it is not possible for us to set this parameter based upon the type of RTL & Non-RTL text.

Is there any alternate way to achieve this?

Waiting for your reply…!!!

Thanks & regards.
Dwarika.

Hi Dwarika,

Thanks for your request. No, unfortunately, I cannot suggest you any other option to insert mixed content into the document except one I already suggested.
Best regards,