com.aspose.words

Class LanguagePreferences

  • java.lang.Object
    • com.aspose.words.LanguagePreferences
public class LanguagePreferences 
extends java.lang.Object

Allows to set up language preferences.
Implements 'Set the Office Language Preferences' dialog in Word.

Example:

Shows how to set up language preferences that will be used when document is loading
LoadOptions loadOptions = new LoadOptions();
loadOptions.getLanguagePreferences().addEditingLanguage(EditingLanguage.JAPANESE);

Document doc = new Document(getMyDir() + "Document.EditingLanguage.docx", loadOptions);

int localeIdFarEast = doc.getStyles().getDefaultFont().getLocaleIdFarEast();
if (localeIdFarEast == EditingLanguage.JAPANESE)
    System.out.println("The document either has no any FarEast language set in defaults or it was set to Japanese originally.");
else
    System.out.println("The document default FarEast language was set to another than Japanese language originally, so it is not overridden.");

Constructor Summary
 
Property Getters/Setters Summary
intgetDefaultEditingLanguage()
void
          

Gets or sets default editing language.

The default value is EditingLanguage.ENGLISH_US.

The value of the property is EditingLanguage integer constant.
 
Method Summary
voidaddEditingLanguage(int language)
Adds additional editing language.
voidaddEditingLanguages(int[] languages)
Adds additional editing languages.
 

    • Constructor Detail

      • LanguagePreferences

        public LanguagePreferences()
    • Property Getters/Setters Detail

      • getDefaultEditingLanguage/setDefaultEditingLanguage

        public int getDefaultEditingLanguage() / public void setDefaultEditingLanguage(int value)
        

        Gets or sets default editing language.

        The default value is EditingLanguage.ENGLISH_US.

        The value of the property is EditingLanguage integer constant.

        Example:

        Shows how to set language as default
        LoadOptions loadOptions = new LoadOptions();
        // You can set language which only
        loadOptions.getLanguagePreferences().setDefaultEditingLanguage(EditingLanguage.RUSSIAN);
        
        Document doc = new Document(getMyDir() + "Document.EditingLanguage.docx", loadOptions);
        
        int localeId = doc.getStyles().getDefaultFont().getLocaleId();
        if (localeId == EditingLanguage.RUSSIAN)
            System.out.println("The document either has no any language set in defaults or it was set to Russian originally.");
        else
            System.out.println("The document default language was set to another than Russian language originally, so it is not overridden.");
    • Method Detail

      • addEditingLanguage

        public void addEditingLanguage(int language)
        Adds additional editing language.
        Parameters:
        language - A EditingLanguage value.

        Example:

        Shows how to set up language preferences that will be used when document is loading
        LoadOptions loadOptions = new LoadOptions();
        loadOptions.getLanguagePreferences().addEditingLanguage(EditingLanguage.JAPANESE);
        
        Document doc = new Document(getMyDir() + "Document.EditingLanguage.docx", loadOptions);
        
        int localeIdFarEast = doc.getStyles().getDefaultFont().getLocaleIdFarEast();
        if (localeIdFarEast == EditingLanguage.JAPANESE)
            System.out.println("The document either has no any FarEast language set in defaults or it was set to Japanese originally.");
        else
            System.out.println("The document default FarEast language was set to another than Japanese language originally, so it is not overridden.");
      • addEditingLanguages

        public void addEditingLanguages(int[] languages)
        Adds additional editing languages.