VSTO插件供WPS使用

 private static void AddRegistertToWPS()
  {
            try
            {
                 //所有插件通用
                RegistryKey key = Registry.CurrentUser;
                Dictionary dic = new Dictionary()
                 {
                         {@"Software\Microsoft\Office\Excel\Addins",@"Software\Kingsoft\Office\ET
                              \AddinsWL" },
                         {@"Software\Microsoft\Office\PowerPoint\Addins",@"Software\Kingsoft\Office\W                                PP\AddinsWL" },
                         {@"Software\Microsoft\Office\Word\Addins",@"Software\Kingsoft\Office\WPS
                                \AddinsWL" },
                  };
                var wps = key.CreateSubKey(@"Software\Kingsoft\Office\ET\AddinsWL");
                foreach (var item in dic)
                {
                    var addins = key.OpenSubKey(item.Key, true);
                    foreach (var subKeyName in addins.GetSubKeyNames())
                    {
                        wps.SetValue(subKeyName, subKeyName, RegistryValueKind.String);
                    }
                }
            }
            catch (Exception)
            {
            }
        }

你可能感兴趣的:(C#,VSTO,wps,excel)