当前位置:文档之家› 1C#开发OFFICE插件

1C#开发OFFICE插件


loading.
/// </summary>
/// <param term='custom'>
///
Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
/// </param>
/// <param term='addInInst'>
///
Object representing this Add-in.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, Extensibility.ext_Connect
string caption, int faceID, Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler
clickHandler) { object missing = System.Reflection.Missing.Value; try { mandBarButton button; //看看按钮是否已经存在 try { button =
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnBeginShutdown(ref System.Array custom)
{
//toolBar.Delete();
}
#endregion
#region 辅助函数 /// <summary> /// 添加一个按钮,并指定点击处理函数 /// </summary> mandBarButton AddButton(
/// </summary>
/// <param term='custom'>
///
Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
/// <seealso class='IDTExtensibility2' />
[GuidAttribute("C1C829AE-FCEB-4640-BF88-FF6CF8712426"), ProgId("WordExtCS.Connect
")]
public class Connect : Object, Extensibility.IDTs notification that the host application is being
/// </summary>
/// <param term='custom'>
///
Array of parameters that are host application specific.
/// </param>
/// <param term='custom'>
///
Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnDisconnection(Extensibility.ext_DisconnectMode disconnect
btnSearch = AddButton(" 查 找 ", 46, new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(search_Click));
btnAdvanced = AddButton(" 高 级 ", 162, new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(advanced_Click));
// by right clicking the project in the Solution Explorer, then choosing install.
#endregion
/// <summary>
///
The object for implementing an Add-in.
/// </summary>
public void OnStartupComplete(ref System.Array custom)
{
//添加定制工具条
try
{
string caption = "投标系统";
object missing = System.Reflection.Missing.Value;
//看看工具条是不是已经存在 try {
Mode, ref System.Array custom)
{ ostShutdown)
}
if(disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_H
{ OnBeginShutdown(ref custom);
} wordApp = null;
{
/// <summary>
/// Implements the constructor for the Add-in object.
/// Place your initialization code within this method.
/// </summary>
public Connect()
// At a later time, if the Add-in becomes unavailable for reasons such as:
//
1) You moved this project to a computer other than which is was originally
Mode connectMode, object addInInst, ref System.Array custom)
{
addInInstance = addInInst;
if (application is Word.Application)
{
wordApp = (Word.Application)application;
toolBar = mandBars[caption]; } catch (Exception) {
//如果不存在,创建工具条 toolBar =
(mandBar)mandBars.Add( caption, Microsoft.Office.Core.MsoB
} catch (Exception) {
MessageBox.Show("添加按钮失败"); }
UpdateUI();
}
interface. unloaded.
/// <summary>
///
Implements the OnBeginShutdown method of the IDTExtensibility2
namespace WordExtCS {
#region Read me for Add-in installation and setup information.
// When run, the Add-in wizard prepared the registry for the Add-in.
}
//添加按钮 try {
btnConnect = AddButton(" 连 接 ", 186, new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(connect_Click));
comboSearch = AddComboBox(" 查 找 内 容 ", new Microsoft.Office.Core._CommandBarComboBoxEvents_ChangeEventHandler(search_Change));
public void OnAddInsUpdate(ref System.Array custom)
{
}
/// <summary>
///
Implements the OnStartupComplete method of the
IDTExtensibility2 interface.
///
Receives notification that the host application has completed
}
if(connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup )
相关主题