单词2010 Visual Studio加载项中的相同变量值正在多个文档之间共享 [英] Same values of variables in word 2010 Visual Studio add-in are being shared across multiple document

查看:91
本文介绍了单词2010 Visual Studio加载项中的相同变量值正在多个文档之间共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#在Visual Studio中开发Office Word 2010加载项。在加载项代码中,我声明了一些类级私有变量。

I am developing an Office Word 2010 Add-In in Visual Studio using c#. In add-in code I have some class level private variables declared.

当打开word文档时,其中一些变量加载了动态值,一些变量在各种事件中加载了值就像DocumentOpen等一样。直到这里都很好。

When a word document is opened then some of these variables are loaded with dynamic values and some are loaded with values in various events like DocumentOpen etc. It's fine till here.

现在我保持打开第一个文档并打开另一个word文档。当在加载事件之前调试时打开第二个文档时,我可以看到变量已经加载了第一个文档的值。

Now I keep the first document opened and open another word document. When this second document is opened while debugging before load event I can see the variables are already loaded with the first document's values.

因此,如果第一个文档'Doc1'有一个名为'docName'的变量我用值"Doc1"分配的文档打开时。现在,当我打开另一个word文档'Doc2'时(第一个文档'Doc1'仍然打开,未关闭),我看到变量'docName'
已经设置了值'Doc1'。

So if first document 'Doc1' has a variable named 'docName' which I assign with value "Doc1" when the document is opened. Now when I open another word document 'Doc2' (first document 'Doc1' is still opened, not closed) I see the variable 'docName' already set with value 'Doc1'.

这不仅发生在打开文档时,而且在每个事件中所有变量的值都在多个文档中共享。

This is not only happening when the Documents are opened but in every events all variables' values are shared across multiple documents.

我不想创建变量数组,因为有很多随着加载项功能的扩展,变量会不断增加。

I do not want to create variable arrays as there are many variables and will keep adding more as functionality of add-in is extended.

非常感谢任何形式的帮助。

Any kind of help is highly appreciated.

提前致谢。

问候,

Syed Abbas

Syed Abbas

此致,Syed Gulam Abbas

Regards, Syed Gulam Abbas

推荐答案

您好Syed,

Hi Syed,

我想将您的问题转移到MSDN Visual Studio工具对于Office论坛而言,因为这可能是专门从事配置的人可以回答的问题。谢谢你的理解。

I'd like to move your question to the MSDN Visual Studio tools for Office forum as this is more likely something that can be answered by people who specialize in configuration. Thanks your understanding.

干杯,

Tony Chen

论坛支持

________________________________________

如果他们提供帮助,请回复并将回复标记为答案,如果他们没有提供任何帮助,请将其取消标记。

如果您对我们的支持有任何反馈,请联系
tnmff@microsoft.com


这篇关于单词2010 Visual Studio加载项中的相同变量值正在多个文档之间共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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