We would like to know that is it possible to change language setting for a word document as shown in the attached image to any other language.
e.g. We are using MS word with keyboard settings English language. If we create a document in say Chinese Language is it possible to get language setting for this document at the bottom as “Chinese Language”
Document doc = new Document("in.doc");
//Create a run of text that contains Russian text.
Run run = new Run(doc, "Test");
//Specify the locale so Microsoft Word recognizes this text as Russian.
//For the list of locale identifiers see http://www.microsoft.com/globaldev/reference/lcid-all.mspx
run.Font.LocaleId = 1028;
doc.FirstSection.Body.LastParagraph.AppendChild(run);
doc.Save("out.doc");
As I have already mentioned that for us the setting language name is not happening for languages like Chinese (PRC), Korean and Japanese.
Take a look at locale ids used for Chinese (PRC) and Korean through code. Do let us know in case we are doing something wrong.
Just for your information, same method is called for rest of the languages like English, Arabic, Finnish and report language setting is displayed properly at the bottom of the entire report for any paragraph, small text or label text.
Do let us know what can be done further to sort out this problem related to Chinese (PRC) and Korean language.
Thanks for your request. Have you tried specifying LocaleIdFarEast as Andrey already suggested? This should properly work. If not, please provide sample code to reproduce the problem.
I tried using following setting instead of just setting localeId
// documentBuilder.Font.LocaleId = localeId;// - Old setting
documentBuilder.Font.LocaleIdFarEast = localeId;// - new setting as per suggestion.
Our application is working as expected by setting LocaleId for all languages except Asian languages like Chinese, Korean etc
After setting LacaleIdFarEast the setting for report language stopped working even for Arabic, Polish, and Finnish etc. So after using LocaleIdFarEast, what was working for us in case 1 stopped working?
Do let us know is there any other workaround to get this resolved.
Thank you for additional information. As I mentioned LocaleIdFarEast will work for Eastern languages, like Chinese, Korean and Japanese.
As Andrey already mentioned there are three property for setting localeId: LocaleId, LocaleIdBi and LocaleIdFarEast. So depending on language, you need to use one of them. If you use European languages, like English, German etc, you should use LocaleId. If you use Arabic languages you should use LocaleIdBi. And if you use Eastern languages you should use LocaleIdFarEast.
Please see the documentation for more information:
Get / set the language identifier of the formatted characters using Font.LocaleId property
Get / set locale identifier of the formatted right-to-left characters using Font.LocaleIdBi property
In our application setting LocaleId and LocaleIdBi is working as required.
Though LocaleIdFarEast is still a problem. Even after setting LacaleIdFarEast, report language displayes English instead of the language used like Korean, Chinese etc.
Any idea why one property is not working while there is no problem for rest 2.
Thank you for additional information. I managed to reproduce the problem. For some reason LocaleIdFarEast option does not work for DOC format (However works fine for DOCX). Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
Thanks for your request. Unfortunately, I cannot provide you any reliable estimate regarding this issue at the moment. We will let you know once the problem is resolved. My apologizes for inconvenience.