Excel:布尔值的本地名称c#

我想知道Excel如何显示布尔值的名称。 例如,如果单元格A1包含true,则英语版的excel将显示“TRUE”并抛光“PRAWDA”。 如何以编程方式检查excel如何显示用户的这些值?

我不认为你可以在没有本地运行应用程序的情况下得到这些信息。 如果有'我想知道如何。

在本地运行Excel,您可以使用以下代码获取本地化的string:

  using System; using MSExcel = Microsoft.Office.Interop.Excel; using System.Runtime.InteropServices; static void Main(string[] args) { MSExcel.Application excel = null; MSExcel.Worksheet sheet = null; string localizedFalse; string localizedTrue; try { excel = new MSExcel.Application(); excel.DisplayAlerts = false; sheet = (MSExcel.Worksheet)excel.Workbooks.Add(MSExcel.XlWBATemplate.xlWBATWorksheet).Sheets.Add(); sheet.Cells[1, 1] = false; sheet.Cells[1, 2] = true; sheet.Columns.AutoFit(); //If the localized string doesn't fit in the default column width, the returned text will be ##########. localizedFalse = sheet.Cells[1, 1].Text; localizedTrue = sheet.Cells[1, 2].Text; Console.WriteLine("Excel localized true: {0} \r\nExcel localized false: {1}", localizedTrue, localizedFalse); Console.ReadLine(); } finally { if (sheet != null) { Marshal.ReleaseComObject(sheet); } if (excel != null) { excel.Quit(); Marshal.ReleaseComObject(excel); } } }