Free Support Forum - aspose.com

Arabic Sentence not coming from Right to Left

Hi there


We are using Aspose Words 16.4.0.0.

We are trying to create word file with Arabic characters and the following sentence is the input into the write function.

"هل قال لك أحد لماذا إختارلك بيت العائلة هذا بالذات؟"

But the output of the word document contains reverse of the above sentence.

Kindly please check the attached sample output and code file.

Please advise us.

Thanks

Hi John,

Thanks for your inquiry. Font.Bidi property specifies whether the contents of this run shall have right-to-left characteristics. Please use Font.LocaleIdBi property to get or set the locale identifier (language) of the formatted right-to-left characters as shown below. Hope this helps you.

We have tested the scenario using latest version of Aspose.Words for .NET 16.11.0 and have not found the shared issue. Please use Aspose.Words for .NET 16.11.0.

var doc = new Document();

var builder = new DocumentBuilder(doc);

PageSetup pagesetup = builder.PageSetup;

pagesetup.PaperSize = PaperSize.A4;

pagesetup.LeftMargin = 65.00;

pagesetup.RightMargin = 39.00;

pagesetup.TopMargin = 40.00;

pagesetup.BottomMargin = 18.00;

pagesetup.Orientation = Aspose.Words.Orientation.Landscape;

pagesetup.HeaderDistance = 25;

pagesetup.TopMargin = ConvertUtil.MillimeterToPoint(25);

builder.MoveToDocumentEnd();

builder.Font.ClearFormatting();

// 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;

// Signal to Microsoft Word that this run of text contains right-to-left text.

builder.Font.Bidi = true;

builder.Font.BoldBi = false;

// Specify the font and font size to be used for the right-to-left text.

builder.Font.NameBi = "Andalus";

builder.Write(s);

doc.Save(MyDir + "Out v16.11.0.doc");




Hi Tahir


It works like a charm.

Thanks for your quick reply.





























Hi John,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.