【发布时间】:2021-06-10 13:17:23
【问题描述】:
我刚刚开始学习如何使用 Visual Studio 为 Outlook 编写加载项。我很难找到资源来阅读 VSTO。 Outlook 个人文具下的“新邮件”和“回复或转发邮件”如何不能修改默认字体?
修改了我的帖子以包含解决方案:
我正在使用此链接 (https://pcloadletter.co.uk/2010/05/19/outlook-default-font-and-signature/) 中的代码并转换为 c#。对于那些尝试这样做的人,这就是我的做法。
private void SetFont()
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Office\16.0\Common\MailSettings", true);
// set the font in Outlook and then export it from the registry. Use that value for our code.
string ComposeFontSimple = @"3c,00,00,00,1f,00,00,f8,00,00,00,00,c8,00,00,00,00,00,
00,00,ff,ff,00,dd,00,22,41,72,69,61,6c,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00";
byte[] arrComposeFontSimpleBin = ArrayHexToDec(ComposeFontSimple.Split(','));
key.SetValue("ComposeFontSimple", arrComposeFontSimpleBin, RegistryValueKind.Binary);
}
public static byte[] ArrayHexToDec(string[] arrHex)
{
byte[] arrDec = new byte[arrHex.GetUpperBound(0)];
for (int i = 0; i < arrHex.GetUpperBound(0); i++)
{
if (arrHex[i] == "00")
{
arrDec[i] = 0;
}
else
{
arrDec[i] = byte.Parse(arrHex[i], System.Globalization.NumberStyles.HexNumber);
}
}
return arrDec;
}
【问题讨论】:
标签: outlook vsto office-interop