Arabic Text priting in English report

Hi Alexey,
We are facing an issue related to arabic text printing into english document.
We are using Aspose.Word version 9.0.0.0
We want to create one english document where some of the portion of the text is in arabic format. We want all english text to be get displayed with left-to-right format & all arbic text must be get displayed into “right-to-left” format with proper paragraph direction settings.
After printing this mixed content document we found that english text get rendered correctly as it was showing proper paragarph direction set to “Left-to-Right” but for arabic text it is expected that the direction of the text should be in “right-to-left”, But it is showing the direction set as “left-to-right” indicating that the arbic text is not printed properly.
Please refer the attached screen shot { Image1 for english text & Image2 for Arabic text paragraph direction setting.}
Please refer the attached word document & sample code for further reference.
In code we are changing the bidi property associated to font to set the “RTL” or “LTR” content
The sample code is as follows:

private void button39_Click(object sender, EventArgs e)
{
    Document doc = new Document();
    DocumentBuilder documentBuilder = new DocumentBuilder(doc);
    XmlDocument XmlDoc = new XmlDocument();
    string[] finalString = null;
    string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
    Aspose.Words.License lic = new Aspose.Words.License();
    lic.SetLicense(path + @"\Aspose.Total.lic");
    Aspose.Pdf.License lic1 = new Aspose.Pdf.License();
    lic1.SetLicense(path + @"\Aspose.Total.lic");
    string samplestr = "ALL";
    string RTLText = "التقييم";
    documentBuilder.ParagraphFormat.ClearFormatting();
    documentBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
    documentBuilder.Font.Name = "Arial unicode MS";
    documentBuilder.Font.Size = 10;
    documentBuilder.InsertHtml(samplestr);
    documentBuilder.Font.Bidi = true;
    documentBuilder.InsertHtml(RTLText);
    documentBuilder.Font.Bidi = false;
    documentBuilder.InsertHtml(samplestr);
    doc.Save("OK.doc");
    StartWord("OK.doc");
}

Will you please re-check this issue with Aspose version 9.0.0.0?
I think the arabic text is not render in correct format as the direction setting showing it in left-to-right format, is this right?
Is there any alernative to fix this issue?
We are waiting for your reply…!!!
Thanks & Regards,
Amit.Saraf

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,

With reference to your code reference we tried to investigate the same issue further & found that the same problem is also exists with your provided sample report.

PFA, The image sample & word document of your sample code for more reference.

Still the at paragraph level text direction for Arabic text was set as “left-to-right” .

As i said we are using Aspose.Word version 9.0.0.0

Will you please re-check the same issue again?

As i said we want to print the mixed content report where the main report is in English but very few text will be in Arabic format.

Just for clarification will you please let us know that when you will launch the complete support for RTL text which will resolve all issue related to { RTL PDF problem, complete HTML support,Font Issues & English-Arabic mix report etc.}?

Is there any predicted date for the above launch?

Waiting for your reply…!!!

Thanks & Regards,
Amit.Saraf

Hi Dwarika,
Thanks for your inquiry. If you need to set direction of the paragraph you should use ParagraphFormat.Bidi property.
Could you also, please attach the expected output you need to generate? This will realy help to proprly inderstand what you would like to achieve.
Best regards,

Hi Alexey,

Thanks for instant reply & service.

we want to generate an English report where some the text will be in Arabic format.

we have gone through this issue & found that we are not setting paragraph bidi property hence the paragraph direction setting always showing for English as well as for Arabic text as left to right.

we want to ensure that Arabic text which i am printing in attached document is printing Arabic& English character properly.[ for which by mistakenly i m checking paragraph property] so which word document property need to check?

How i will check that Arabic text is actually an proper Arabic formatted text & English text is a proper English text in mixed document? {This question is from developers point of view }

Waiting for your reply.

Thanks & Regards,
Amit.Saraf

Hi Dwarika,
Thank you for providing the example. As I can see in your document example you have exactly the same as is produced by my initial code example. The only difference in your example you have Arabic text surrounded by English text, and in my example English text was surrounded by Arabic. So you should just use code like I already provided.
To make sure that Arabic text is in RTL format and English text is in LRT format, you should just make sure that Bidi property is properly set, i.e. it is true for Arabic text and false for English.
Best regards,

Hi Alexey,

Thanks for providing solution and quick reply.

which property we have to check on actual word document that indicates us the English & Arabic text was printed properly.

we cannot check the paragraph formatting properties as we are not changing any code related to paragraph.bidi

Waiting for your reply…!!!

Thanks & Regards,
Dwarika

Hi Dwarika,
Thanks for your inquiry. As I already mentioned, you should check Font.Bidi property for each run in the document. If Run contains Arabic text, this property should be set to true. If Run contain English text, this property should be false.
Best regards,

The issues you have found earlier (filed as WORDSNET-1980) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(73)