如何改变Word的颜色? [英] How to change the color sheme of Word?
本文介绍了如何改变Word的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C#以编程方式更改Microsoft Word的colorsheme?
我在Word 2010上,我传递了一个主题枚举:
How can I change the colorsheme of Microsoft Word programmatically using C#?
I'm on Word 2010, I pass one of theme enums:
ActiveDocument.DocumentTheme.ThemeColorScheme.Colors(MsoThemeColorSchemeIndex.msoThemeDark1);
但colorSheme不会改变。
我在哪里做错了?
But colorSheme doesnot change.
Where am I doing wrong?
推荐答案
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;
}
}
这篇关于如何改变Word的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文