如何访问 Office IEnumerable 接口?

How to access an Office IEnumerable interface?

我正在尝试使用 VS2013 为 PowerPoint 编写 C# 加载项。但是(在缺席编程多年后 :) 我正在为 C# 苦苦挣扎。

任务是让用户选择一种已安装的校对语言并为所有幻灯片设置它。

首先,PowerPoint 似乎没有获取installed/available 校对语言的功能,但显然Word 有。所以我开始使用 Word 并发现:

Microsoft.Office.Interop.Word.Languages

但是我还没有弄到校对语言的合集;它是一个 IEnumerable 接口,所以我无法实例化它。

正确的代码是什么?

您应该使用语言 属性 来获取语言集合。

_Application.Languages Property

Returns a Languages collection that represents the proofing languages listed in the Language dialog box.

此处_Application表示Microsoft Office Word应用程序。