Class LanguagePreferences

Class LanguagePreferences

Namespace: Aspose.Words.Loading
Assembly: Aspose.Words.dll (26.4.0)

Allows to set up language preferences.

To learn more, visit the Specify Load Options documentation article.

public class LanguagePreferences

Inheritance

object LanguagePreferences

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Shows how to apply language preferences when loading a document.

LoadOptions loadOptions = new LoadOptions();
loadOptions.LanguagePreferences.AddEditingLanguage(EditingLanguage.Japanese);

Document doc = new Document(MyDir + "No default editing language.docx", loadOptions);

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

Remarks

Implements ‘Set the Office Language Preferences’ dialog in Word.

Constructors

LanguagePreferences()

public LanguagePreferences()

Properties

DefaultEditingLanguage

Gets or sets default editing language.

The default value is Aspose.Words.Loading.EditingLanguage.EnglishUS.

public EditingLanguage DefaultEditingLanguage { get; set; }

Property Value

EditingLanguage

Examples

Shows how set a default language when loading a document.

LoadOptions loadOptions = new LoadOptions();
loadOptions.LanguagePreferences.DefaultEditingLanguage = EditingLanguage.Russian;

Document doc = new Document(MyDir + "No default editing language.docx", loadOptions);

int localeId = doc.Styles.DefaultFont.LocaleId;
Console.WriteLine(localeId == (int)EditingLanguage.Russian
    ? "The document either has no any language set in defaults or it was set to Russian originally."
    : "The document default language was set to another than Russian language originally, so it is not overridden.");

Methods

AddEditingLanguage(EditingLanguage)

Adds additional editing language.

public void AddEditingLanguage(EditingLanguage language)

Parameters

language EditingLanguage

Examples

Shows how to apply language preferences when loading a document.

LoadOptions loadOptions = new LoadOptions();
loadOptions.LanguagePreferences.AddEditingLanguage(EditingLanguage.Japanese);

Document doc = new Document(MyDir + "No default editing language.docx", loadOptions);

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

AddEditingLanguages(EditingLanguage[])

Adds additional editing languages.

public void AddEditingLanguages(EditingLanguage[] languages)

Parameters

languages EditingLanguage []

 English