问题标签 [mailmerge]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
2382 浏览

javascript - 通过 Javascript 的 MS Word 对象模型:邮件合并

我正在为当地的慈善机构构建一个网站应用程序,进展顺利,我似乎克服了大多数挑战,但这是我遇到的一个巨大问题,我什至不知道这是否可能。

我希望用户能够单击一个按钮并通过邮件在服务器端合并文本文件和预建模板 (dotx) 文件来输出 Microsoft Word 文件。该文本文件将仅包含一条从 mySQL 数据库中获取并通过 PHP 生成的记录。

我知道使用 XSLT 来修改文档 zip 中的文档文件,但我无法访问 charities 服务器上的 php.ini,无论如何考虑到使用创建宏有多简单,这似乎有点太多了邮件合并。

所以我现在正在考虑使用 Word 对象模型,它必须通过 Javascript,但大多数用户使用 Firefox 或 Chrome,例如。var oApplication = new ActiveXObject("Application.Word");使用这些浏览器,还是我可以简单地使用= new Object("Application.Word");

我也可以确认 Javascript 中的对象将具有与 VBA 中相同的函数名称和参数,我从未尝试过通过 Javascript 使用 Word,但如果它与 VBA 相同,那么我应该没问题。

我正在使用我的本地主机进行开发,文件结构是:

  • 模板\构象.docx
  • 模板\data.txt

其中 data.txt 是 PHP 生成的从数据库中获取的数据的 CSV。

0 投票
1 回答
781 浏览

vb.net - Telerik 邮件合并 - 友好名称(使用 RadRichTextBox)

我想我遗漏了一些明显的东西......我正在为 WPF 使用 Telerik Rad 控件,但我认为富文本框对邮件合并功能使用了一些类似的实现。

我想在我的邮件合并字段上有一些友好的名字。(即字段名称中的空格)所以我有一个类例如

这是我知道在邮件合并下拉列表中获取“友好”名称的唯一方法。所以这两个字段可以正常显示为:“这是该字段的复杂描述”“另一个复杂字段”

但是当您进行合并时,实际上只有另一个复杂字段会填充数据。

我是否必须对包含邮件合并字段的 raddropdownbutton 进行模板化?在某处有这样的例子吗?

也是一个子问题。我如何在这些东西上添加滚动条?

(我也知道这个板不是 TELERIK 特定的板(呃!)但这可能对将来的某人有用。所以我将从 Telerik 得到的答案复制到这里! http://www.telerik.com /community/forums/wpf/richtextbox/558428-radrichtextbox-mailmerge---using-displayname-to-create-a-friendly-name-with-spaces.aspx )

0 投票
1 回答
2046 浏览

vb.net - 通过 VB.NET 在 Word 表中邮件合并数据

上面的代码在合并期间基本上显示了 word Document 中不同页面中的所有 productName。

请帮助我如何将数据放入表格中。我必须为我的 ProductName、AccountNo、OutBalance、AccountName 等编写多个代码。我的问题是我不知道如何将它们放在一个表中。

0 投票
1 回答
5014 浏览

devexpress - How do I programmatically merge data in DevExpress RichEditControl?

I want to allow users to select from a list of predefined templates. When a template is selected, the RichEditControl (REC) displays a document formatted according to the selected template, with fields already merged. (The user never sees the double-bracket "code-behind" of the merge document.) My templates are in a database as varbinary and passed up to the gui as byte arrays in a class that, stripped down, looks like this:

In the form that contains the REC, I'm calling the following method in the event handler for the changed event of the drop-down that contains the available templates (the letterWriterEditor is my REC, and the templateBindingSource is bound to the LetterWriterMergeFieldCollection, a class containing string properties representing the fields I'd like to have the option of merging in the document, along with their values for this particular letter (determined elsewhere in the program)):

I have the following statement in this form's constructor:

The merge fields are bound fine: I can insert them manually using one of the Mailings buttons in the REC's ribbon bar. But the document ends up blank when I attempt to do it programmatically. I'd like it to end up as a merged letter ready for saving as soon as the user selects the desired template. My understanding is that, with the ViewMergeData property set to true, this is what should be happening.

If anyone has any ideas, I'd be grateful. Thanks in advance.

0 投票
2 回答
14724 浏览

excel - excel VBA在邮件合并过程中提示时自动选​​择是

我希望系统对我的用户尽可能自动化。现在,我有在用户单击按钮时运行的代码。该代码获取数据的目的是通过邮件合并将其应用于 Word 文档。

一切都按预期工作,除了总是弹出一条消息说

打开此文档将运行以下 SQL 命令:

选择 * FROM 'TAGS$'

数据库中的数据将被放置在文档中。你想继续吗?

我需要尽可能简单地保持这一点,而不会冒着用户选择“否”的风险,因为他们感到困惑。VBA 如何自动继续并接受数据放置,就像他们选择“是”一样?

我尝试仅使用以下代码来阻止警报,希望它会默认为“是”并继续,但它不起作用。

这就是我所拥有的

0 投票
1 回答
2085 浏览

vba - 使用 VBA 创建后删除 Word 中的文本和表格

我在编写邮件合并时遇到了一些问题,因为我的代码创建的每个内容都必须被删除,以免在合并过程中妨碍下一个字母。

所以我写了一个测试宏只是为了创建一些表并删除它们。

这是我的进度 - 它可以在一个新的空 Word 文件中运行,该文件带有一个名为“test”的书签

你看。表格将被正确删除。但是文本和段落呢?有没有一种方法可以从起点到终点进行选择并删除其所有内容。

0 投票
2 回答
413 浏览

ms-office - 是否可以编写一个单词插件或类似的东西来提供自定义邮件合并数据源?

我有一个后端系统,我想将其用作 MS Word 2010 邮件合并的数据源。我的想法是我应该编写一个单词加载项,它提供数据源并通过 Web 服务与我的后端通信。

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

谢谢

0 投票
1 回答
3480 浏览

c# - 来自数组或列表的邮件合并

这个站点中是一个关于使用 2 个数组和 MailMerge.Execute 方法进行邮件合并的示例,但该方法不接受 2 个参数。

无论如何,有没有办法用 2 个数组或 2 个列表做类似的事情?

谢谢。

这是他们使用的代码:

这是我要实现的方法:

0 投票
2 回答
6641 浏览

c# - MailMerge 使用 sql server 数据库

我正在尝试使用 SQL Server 数据库作为 c# 中的数据源进行 MailMerge。可能吗?我已经用谷歌搜索了几天没有任何有效的结果。有人可以为我提供任何有效的链接或解释如何实现这一点吗?请帮忙。提前致谢。

0 投票
2 回答
1522 浏览

ms-word - 文本文件作为 MS Word 中 MailMerge 的数据源 - 如何在字段中插入手动换行符而不是段落标记?

我创建了一个文本文件作为 microsoft word 中邮件合并的数据源。这很好用。现在,我有包含多行值的字段。当我在模板中使用此字段时,它会创建一个“硬”换行符(段落标记)。我必须在文本文件中插入什么,该词将创建“软”换行符(手动换行符)?