是否可以编写一个单词插件或类似的东西来提供一个自定义的mailmerge数据源? [英] Is it possible to write a word add-in or something similar to provide a custom mailmerge datasource?

查看:83
本文介绍了是否可以编写一个单词插件或类似的东西来提供一个自定义的mailmerge数据源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个后端系统,我想用作MS Word 2010 mailmerge的数据源. 我的想法是,我应该写一个单词外接程序来提供数据源,并通过Web服务与我的后端进行通信.

I've a backend system which I want to use as the datasource for MS Word 2010 mailmerge. I've the idea that I should write a word add-in which provides the datasource and is communicating with my backend over webservices.

通常可以提供带有单词add in的自定义数据源吗? 有没有解决办法? 是否可以在C#中执行此操作? 在哪里可以找到有关这方面的信息?

Is it generally possible to provide a custom datasource with a word add in? Is there a besser solution? Is it possible to do this in C#? Where can I found moar informations about this?

谢谢

推荐答案

Word开箱即用的Mailmerge功能可以使用的数据源类型是众所周知的-例如,

The types of data source that Word's out-of-the-box Mailmerge feature can use are well known - e.g.

  1. 文件类型的数据源,例如Word文档,纯文本文件, Excel工作簿等,
  2. "DDE"源(Access,Excel和MS Query,它们依次希望 使用ODBC连接)
  3. ODBC数据源和
  4. OLE DB数据源(这些必须符合某些标准,这些标准 没有记录AFAIK,例如我认为提供商必须实施 iCommand)
  1. file-type data sources such as Word documents, plain text files, Excel workbooks and so on,
  2. "DDE" sources (Access, Excel, and MS Query, which in turn expects to work with ODBC connections)
  3. ODBC data sources and
  4. OLE DB data sources (these have to conform to some criteria which AFAIK are not documented, e.g. I think the provider has to implement iCommand)

要使用内置的Mailmerge,Word必须打开源,并且您不能覆盖OpenDataSource.

To use the built-in Mailmerge, Word has to open the source, and you cannot override OpenDataSource.

没有接口可让您直接使用ADO.NET数据源或断开连接的记录集.如果要这样做,则必须滚动自己的" mailmerge.您可以考虑的一个起点是埃里克·怀特(Eric White)的系列文章-例如,参见此处.

There's no interface that lets you use an ADO.NET data source directly, or a disconnected recordset. If you want to do that, you have to "roll your own" mailmerge. One starting point you could consider is Eric White's series of articles - see, e.g. here .

否则,您必须确保您的数据源是以上内容之一.对于ODBC源,还必须使用DSN-您不能使用不带DSN的连接字符串进行连接.您可以避免通过系统或计算机DSN使用文件",但实际上分发文件DSN比在目标计算机上创建文件DSN可能更容易.

Otherwise, you have to ensure that your data source is one of the above things. In the case of ODBC sources, you also have to use a DSN - you can't connect using a DSN-less connection string. You can avoid using a "file" using a System or Machine DSN, but it may actually be easier to distribute a file DSN than create one on the target machine.

对于OLE DB数据源,您必须具有某种类型的连接文件",即.udl或.odc

In the case of OLE DB data sources, you have to have a "connection file" of some kind, either a .udl or .odc

最后一点:就Word而言,"ODBC"为旧",而"OLE DB"为新.但是微软不久前宣布,它已弃用OLE DB,而改用ODBC.目前尚不清楚该 only 是否适用于SQL Server,也没有看到任何资料可以告诉我们Word在将来将支持/支持的内容.同时,当然,更多的文档和数据存储在云位置,而某些ODBC/OLE DB驱动程序/提供程序可能无法访问这些文件和数据.

A final note: as far as Word is concerned, "ODBC" is "old" and "OLE DB" is newer. But Microsoft announced some time ago that it was deprecating OLE DB in favour of ODBC. It isn't clear whether that only applies to SQL Server, nor have I seen anything that tells us what Word will support/favour in future. Meanwhile, of course, a lot more documents and data are being stored in cloud locations which may not be accessible using some ODBC/OLE DB drivers/providers.

这篇关于是否可以编写一个单词插件或类似的东西来提供一个自定义的mailmerge数据源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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