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

Free Support Forum - aspose.com

Set the language for an entire Word document


I know I can set the language of text using the LocaleId property of Font, but how can I set the language of an entire Word document like you can in Microsoft Word?




You can get or set default editing language by using the LanguagePreferences.DefaultEditingLanguage Property. Sample code is as follows:

Add Japanese language to the editing languages:

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();

Document doc = new Document("D:\\Temp\\input.docx", loadOptions);

int localeIdFarEast = doc.Styles.DefaultFont.LocaleIdFarEast;
if (localeIdFarEast == (int)EditingLanguage.Japanese)
    Console.WriteLine("The document either has no any FarEast language set in defaults or it was set to Japanese originally.");
    Console.WriteLine("The document default FarEast language was set to another than Japanese language originally, so it is not overridden.");

You may also check other properties/methods of LanguagePreferences Class.

Hi awais.hafeez,

Thank you very much for your help, much appreciated!

Your example works fine when loading an existing document from file. Is it also possible to do this with a new document? For example something like:

Document document = new Document();

document.LanguagePreferences.AddEditingLanguage(EditingLanguage. Japanese);

Thanks a lot in advance,


It should also work. In case you still face any problem, please share complete simplified code here for testing.

I’m afraid I did not make myself clear: the examples I gave are what I would like to have, they are currently not possible…

  • There is no constructor for Document (without a stream or filename parameter) with a LoadOptions parameter.

  • There is also no LanguagePreferences or likewise property for Document.

So I am looking for another way of achieving this.


Please check the following code if that is acceptable for you?

Document doc = new Document();
doc.Styles.DefaultFont.LocaleId = (int)EditingLanguage.Japanese;

Also, please check the following code:

Document doc = new Document();
MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Docx);

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();

Document docx = new Document(stream, loadOptions);

Thanks for your help, awais.hafeez: this did the trick!