We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Arabic text Alignmnet

Hi Alexey,

Thanks for your quick service & response.

We are facing an issue related to text alignment in arbic text format.

We are using Aspose.Word version 9.0.0.0

We are also implemnenting BIDI property which supports RTL document printing.

After Implementing the BIDI property if we set the text alignment as "left" then in actual document the entire text is placed at "right-side" of the page & similarly if we set the alignment as "left" the text resides at "right-side" of the final document.

The direction is properly indicates as "Right-To-Left" but for left aligned document it is showing as a "right" { Plaese refer the attached screen shot "document-Setting.png" for further reference.

Please refer the "Sample.doc" fo further reference.

The sample code is as follows.

private void button35_Click(object sender, EventArgs e)

{

Document doc = new Document();

DocumentBuilder documentBuilder = new DocumentBuilder(doc);

XmlDocument XmlDoc = new XmlDocument();

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");

documentBuilder.ParagraphFormat.ClearFormatting();

documentBuilder.ParagraphFormat.Bidi = true;

documentBuilder.Font.Bidi = true;

documentBuilder.Font.NameBi = "Arial unicode MS";

documentBuilder.Font.SizeBi = 10;

documentBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Left;

//sample text

documentBuilder.InsertHtml("التقييم");

doc.Save("OK.doc");

StartWord("OK.doc");

}

1> Is this behaviour is right ? i mean for all RTL languge left alignment is actally a right side of document?

2> If the answer for above question is fine then why the alignment parameter in actual document is not showing text alignment as "left" as per RTL? { please refer my screen-shot for further reference?}

Will you please provide some input on this issue?

Waiting for your reply.......!!!!

Thanks & Regards,

Dwarika.

Hi Dwarika,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. If you need to get left aligned paragraph in RTL document you should specify right alignment. Please see the following code:

Document doc = new Document();

DocumentBuilder documentBuilder = new DocumentBuilder(doc);

documentBuilder.ParagraphFormat.ClearFormatting();

documentBuilder.ParagraphFormat.Bidi = true;

documentBuilder.Font.Bidi = true;

documentBuilder.Font.NameBi = "Arial unicode MS";

documentBuilder.Font.SizeBi = 10;

documentBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Right;

//sample text

documentBuilder.InsertHtml("التقييم");

doc.Save(@"Test001\out.doc");

Best regards,