如何使用C#以编程方式更改Microsoft Word的配色方案?
答案 0 :(得分:0)
如果您使用的是Word 2010,那么应该执行以下操作,您需要传递一个主题枚举。
ActiveDocument.DocumentTheme.ThemeColorScheme(msoThemeLight2)
您可以在这里找到A complete list of Word and Office ThemeColorIndex Enumeration Constants
答案 1 :(得分:0)
const string OfficeCommonKey = @"Software\Microsoft\Office\14.0\Common";
const string OfficeThemeValueName = "Theme";
const int ThemeBlue = 1;
const int ThemeSilver = 2;
const int ThemeBlack = 3;
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(OfficeCommonKey, true))
{
int theme = (int)key.GetValue(OfficeThemeValueName,1);
switch (theme)
{
case ThemeBlue:
//...
break;
case ThemeSilver:
// ...
break;
case ThemeBlack:
// ...
break;
default:
// ...
break;
}
}