Free Support Forum - aspose.com

Complex writing

Dear Sir

I have FormField object in a section in my Word document.I use "Aspose.Words" component for filling this formfield through my program. It is work very nice with both right to left and left to right languages but when I want to use a complex script(mix of right to left and left to right languages) this component reverse it and Bidi property can't do anything for me.

Please tell how do I solve this problem because it'ss very important for me.

Thanks

Mehdi Mokhtari

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

Thanks for your request. Every form field in the document is marked by bookmark. So you can use DocumentBuilder to navigate in the document. You can also use Documentbuilder to insert RTL and LTR text into the form field. For example try using the following code:

Document doc = new Document(@"Test168\in.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

//Get formfield from document

FormField myFormField = doc.Range.FormFields["myFormField"];

myFormField.Result = string.Empty;

//Move cursor of DocumentBuilder to bookmark that marks Formfield

builder.MoveToBookmark(myFormField.Name, true, true);

//Search for the FieldEnd Node

Node currentNode = builder.CurrentNode;

while (currentNode.NodeType != NodeType.FieldEnd)

{

currentNode = currentNode.NextSibling;

}

//Move cursor to the end of field

builder.MoveTo(currentNode);

//Insert left to Right text

builder.Write("test");

//insert right to left text

builder.Font.Bidi = true;

builder.Font.LocaleIdBi = 1025;

builder.Write("مرحبًا");

//Save document

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

I hope this could help you.

Best regards.

Dear Sir

Thanks for your quick reply and your solution.But I must fill my FormField with a parameter and your solution needs more line of code and I must detect character by characer.

I want to know could you fix this problem in your component or not and if you could fix it in which version and how long you will do it?

Thanks

Mehdi Mokhtari

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

Thanks for your request. I have created new issue #5099 in our defect database. I can’t promise you that we will fix this issue in the nearest future. So I think that you should use the workaround I suggested.

Best regards.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan