Word 打开 XML 邮件合并

发布于 2024-09-15 17:47:28 字数 711 浏览 5 评论 0原文

我正在尝试使用 Word 的 XML(来自 Word 2007)手动创建邮件合并。我有以下无效的 XML:

<w:mailMerge>
    <w:mainDocumentType w:val="catalog" />
    <w:linkToQuery />
    <w:dataType w:val="native" />
    <w:connectString w:val="Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=TheServer;Data Source=." />
    <w:query w:val="SELECT * FROM  `Table` WHERE `id_field` = 7" />
    <w:dataSource r:id="rId1" />
    <w:activeRecord w:val="0" />
</w:mailMerge>

我无法从文档中真正弄清楚我应该做什么。这只是来自数据库表的邮件合并。它表示 行有错误。我已经查找了 w:val 的可能值,但没有任何运气。我找不到任何像样的文档。

有人有什么想法吗?

I'm attempting to manually create a mail merge using Word's XML (from Word 2007). I have the following XML which isn't working:

<w:mailMerge>
    <w:mainDocumentType w:val="catalog" />
    <w:linkToQuery />
    <w:dataType w:val="native" />
    <w:connectString w:val="Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=TheServer;Data Source=." />
    <w:query w:val="SELECT * FROM  `Table` WHERE `id_field` = 7" />
    <w:dataSource r:id="rId1" />
    <w:activeRecord w:val="0" />
</w:mailMerge>

I can't really figure out from the documentation what I'm supposed to do. This is just a mail merge from a database table. It says there's an error on the line <w:mainDocumentType w:val="catalog" />. I've looked up possible values of w:val without any luck. I can't find any decent documentation on it.

Anyone have any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

妞丶爷亲个 2024-09-22 17:47:35

在你的sql命令中,你没有使用常规的单引号('),而是我在人们使用国际键盘时看到的那种单引号(“`”与“'”)。我不知道 SQLOLEDB 提供程序如何工作,但我习惯于看到表和列名称周围的括号而不是引号。

使用 Microsoft Word,按照您想要的方式在测试文档中设置邮件合并。然后查看使用 Open XML SDK 工具生成的 xml,您可以在此处获取该工具:
http://www.microsoft.com/download/en /details.aspx?displaylang=en&id=5124

将 word 生成的 xml 与您的代码进行比较,看看哪里可能出了问题。

请注意,aw:mailMerge 可能依赖于外部资源,在这种情况下,您需要包含数据源引用。

in your sql command you aren't using regular single quotes (') but the kind i see when people have international keyboards ( "`" vs "'" ). i don't know how the SQLOLEDB provider works but i am used to seeing brackets around table and cloumn names rather than quotes.

using microsoft word, set up mail merging in a test document just how you want it. then view the xml that word generated using the Open XML SDK Tool which you can get here:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124

compare the xml that word generates to your code to see where you may have gone wrong.

note that a w:mailMerge may depend on an external resource, in which case you include a data source reference.

挖鼻大婶 2024-09-22 17:47:33

DII 拥有所有文档,您也可以查找此文档站点,例如 mainDocumentType 被列为 CT_MailMergeDocType。搜索后,我得到它然后告诉我查找 ST_MailMergeDocType,其中列出了类型。

另外,OpenXML Developer 有一些使用 WordprocessingML 进行 MailMerge 的基本介绍文章:

DII has all of the documentation and you can also look up on this site, like the mainDocumentType is listed as a CT_MailMergeDocType. Upon searching for that, I get which then tells me to look up ST_MailMergeDocType, where it lists the types.

Also, OpenXML Developer has some basic intro articles to MailMerge with WordprocessingML:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文