Hello ,
I am using MailMerge feature for export to word.
Data may contain Multilingual Text , How to show that multilingual text in word. And in case font not available then what ?
Regards ,
Hello ,
I am using MailMerge feature for export to word.
Data may contain Multilingual Text , How to show that multilingual text in word. And in case font not available then what ?
Regards ,
Hi Ashish,
Thanks for your inquiry. You need to specify Bidi to either true (for right-to-left languages) or false Please try specifying the Font.Bidi and ParagraphFormat.Bidi properties as follows:
DocumentBuilder builder = new DocumentBuilder();
// Signal to Microsoft Word that this run of text contains right-to-left text.
builder.Font.Bidi = true;
builder.CurrentParagraph.ParagraphFormat.Bidi = true;
// Specify the locale so Microsoft Word recognizes this text as Hebrew - Israel.
// For the list of locale identifiers please see https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a
builder.Font.LocaleIdBi = 1037;
// Insert some Hebrew text.
builder.Writeln("הלכה למשה מסיני");
builder.Document.Save(@"C:\Temp\out.docx");
I hope, this helps.
Best regards,
Thanks Awais ,
Thanks for your reply , what will be LocaleIdBi for different languages , we support 35 languages , from where will I get LocaleIdBi for those languages ?
Regards ,
Hi Ashish,
Thanks for your inquiry. Please refer to the following page:
https://msdn.microsoft.com/en-US/goglobal/bb964664.aspx
Best regards,
I tried using your solution it does not work for Indian languages like Hindi and malayalam.
Hi Ashish,
Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:
As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.
Best regards,
Hello,
I have attached the files you asked for
Regards,
Hi Ashish,
Thanks for your inquiry. It seems you’re using older version of Aspose.Words i.e. 13.4.0 on your end. I suggest you please upgrade to the latest version 15.2.0 from the following link:
https://downloads.aspose.com/words/net
Secondly, I could see only abc.doc (Aspose.Words generated document) and language.docx (template/input document) in attachment. The expected document and source code are missing . Please attach these missing resources here for testing. We will then investigate the issue on our end and provide you more information.
Best regards,
Hi
I have attached the remaining files
Regards
Hi Ashish,
Thanks for the details. Please try using the following code to achieve this:
Dim doc As New Document(MyDir & "language.docx")
doc.MailMerge.FieldMergingCallback = New HandleMergeFields()
doc.MailMerge.Execute(New String() {"hindi", "", ""}, New Object() {"छठा विकेट गिरा, अफ़रीदी भी लौटे", "", ""})
doc.Save(MyDir & "out.docx")
Private Class HandleMergeFields
Implements IFieldMergingCallback
Private Sub IFieldMergingCallback\_FieldMerging(ByVal args As FieldMergingArgs) Implements IFieldMergingCallback.FieldMerging
If args.FieldName.Equals("hindi") Then
Dim builder As New DocumentBuilder(args.Document)
builder.MoveToMergeField(args.FieldName)
builder.Font.NameFarEast = "Mangal"
builder.Font.Bidi = False
builder.Font.LocaleIdBi = 439
builder.Writeln(args.FieldValue.ToString())
End If
End Sub
Private Sub ImageFieldMerging(ByVal e As ImageFieldMergingArgs) Implements IFieldMergingCallback.ImageFieldMerging
' Do nothing.
End Sub
End Class
I hope, this helps.
Best regards,
Hi
Thank you for the solution!!!
My document contains multiple language for different text. i.e. it may contain English, Hindi, Arabic, Español. In this case for other languages its working fine, For Hindi its not working.
In this case how to know which language text it is to implement your solution.
plz Find attached expected.doc file
Regards
Hi Ashish,
Thanks for your inquiry. I am afraid, there is no way in Aspose.Words that you can use to detect language of a particular string of text. But, you can try searching the web to see how different language detection algorithms work. If we can help you with anything else, please feel free to ask.
Best regards,