Bagikan melalui


Globalization Considerations for Excel Controls

By default, host controls in Microsoft Office Excel work correctly in any Windows regional setting, as long as all data that is passed or manipulated using managed code is formatted using English (United States) formatting. In projects that target the .NET Framework 4, this behavior is controlled by the common language runtime (CLR). In projects that target the .NET Framework 3.5, this behavior is in effect as long as the Microsoft.Office.Tools.Excel.ExcelLocale1033Attribute in your project is set to true. For more information, see Formatting Data in Excel with Various Regional Settings.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

If you set the Microsoft.Office.Tools.Excel.ExcelLocale1033Attribute to false, host controls do not work correctly if the end user has an English language version of Excel, but has Windows regional settings for a region other than English (United States). You can resolve the issues by installing the Multilingual User Interface (MUI) pack.

When the ExcelLocale1033Attribute Is False in Projects that Target the .NET Framework 3.5

The functionality of host controls in Excel, such as data binding and events, relies on calls to the Microsoft Office Excel object model through the primary interop assemblies (PIAs). If a solution is run on an English version of Excel in a non-"en-US" environment, user interaction with a host control can cause the same errors that can be caused by an explicit programmatic call into the COM object model.

For example, the BeforeDoubleClick event of a NamedRange control might not be raised when the control is double-clicked because a call is made to a method in the Excel object model to determine whether the event occurred within the named range. When the locale passed to this method call is not English (United States), the method fails and the event is not raised. If a localized version of Excel is used, or if the English version of Excel is used along with the MUI pack, these errors will not occur.

See Also

Tasks

How to: Make String Literals Region-safe in Excel Using Reflection

Concepts

Formatting Data in Excel with Various Regional Settings

Globalization and Localization of Office Solutions

Host Items and Host Controls Overview