C# - 如何将参数从我的应用程序传递到MailMergeBeforeRecordMerge事件 [英] C# - How to pass a parameter from my application to a MailMergeBeforeRecordMerge event 

查看:111
本文介绍了C# - 如何将参数从我的应用程序传递到MailMergeBeforeRecordMerge事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#.net 在Windows 7上运行的Windows应用程序。   此应用程序使用.xls进行mailmerge 作为数据源。  有一个 我的应用程序
正在使用的Microsoft mailmerge事件进行一些操作。 此Microsoft mailmerger事件名为
MailMergeBeforeRecordMerge 事件。   ;



使用的原始绑定是




ObjAppWord.MailMergeBeforeRecordMerge + =   
ObjAppWord_MailMergeBeforeRecordMerge ;




原始方法定义为




       私人
void ObjAppWord _MailMergeBeforeRecordMerge(Word.Document Doc,
ref bool 取消)


        {


           ...。做事.......


        }




但我需要什么?现在更新此操作是为了将参数 从我的应用程序传递到此
MailMergeBeforeRecordMerge  事件方法,因此方法定义可能如下所示




私人 void ObjAppWord_MailMergeBeforeRecordMerge(Word。 文档
Doc,
ref
bool 取消
列表 < string > dataHdrNames


{



......做点东西......




}




如何更改原始装订定义



ObjAppWord.MailMergeBeforeRecordMerge + =   
ObjAppWord_MailMergeBeforeRecordMerge ;



包含 我的应用程序中的参数是做什么的? 或者有没有办法更改mailmerge方法定义以包含我的应用程序中的添加参数?




我看了几种不同的语法,但还没找到正确的方法。 

解决方案

嗨  apepper,


对于您的问题,它与Office开发更相关。你应该在  Office
开发论坛
。  
Visual C#论坛讨论并询问有关C#编程语言,IDE,库,示例和工具的问题。


Dolen


I have a C#.net  windows application running on windows 7.    This application does a mailmerge using .xls  as a data source.   There is a  Microsoft mailmerge event that my application is using to  do some manipulation.  This Microsoft mailmerger event is  called MailMergeBeforeRecordMerge event .  

The original binding used was

ObjAppWord.MailMergeBeforeRecordMerge +=   ObjAppWord_MailMergeBeforeRecordMerge;

With the original method definition as

       private void ObjAppWord_MailMergeBeforeRecordMerge(Word.Document Doc, ref bool Cancel)

        {

           …. Do stuff ….

        }

But what I need to do now is update this to pass a parameter from my application to this MailMergeBeforeRecordMerge  event method so the method definition could look like

private void ObjAppWord_MailMergeBeforeRecordMerge(Word.Document Doc, ref bool Cancel, List<string> dataHdrNames)

{

… do stuff …

}

How do I change the original binding definition  of

ObjAppWord.MailMergeBeforeRecordMerge +=   ObjAppWord_MailMergeBeforeRecordMerge;

To include  a parameter from my application to do this ?  Or is there a way to change the mailmerge method definition to include the addition parameter from my application ?

I look at several different syntaxes but haven’t found the right way yet. 

解决方案

Hi apepper,

For your question, it is more related to Office development. you should post your question in Office Development forum.  The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

Dolen


这篇关于C# - 如何将参数从我的应用程序传递到MailMergeBeforeRecordMerge事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆