Question

using .NET Clipboard API you can write following code:

//dataObject - instance of IDataObject, received from Clipboard
if (dataObject != null)
{
    if (dataObject.GetDataPresent(DataFormats.Locale))
    {
        var data = dataObject.GetData(DataFormats.Locale);
        var locale = AsInt(data);
        if (locale.HasValue)
        {
            return new CultureInfo(locale.Value);
        }
     }
}

int? AsInt(object data); - my method which tries to read `Int32` value from `MemoryStream`

The question is why I always get en-US locale even when my PC's locale is ukrainian? I cannot get it, I thought Windows OS puts current locale info into clipboard when copy operation is performed? Isn't it?

UPD: I need to know locale of the object inside the clipboard, if it is possible

UPD2: My PC's locale is uk-UA, PC's UI locale is en-US, FAR Manager puts something different to clipboard (value 1024, which cannot be recognizsed as valid locale identifier). So it seems to be Excel2010 problem.

Was it helpful?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top