问题标签 [mergefield]

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 投票
1 回答
18260 浏览

text - Word - 如何将文本粘贴到页面底部

https://SURU.tinytake.com/sf/MTQxMTgzOV81MDc2MDI2

我想在页面底部粘贴一些文本,比如在屏幕上,总是在页脚之前。当有文本(来自合并字段)时,下一个应该是新行。我希望屏幕截图更容易看到。

0 投票
0 回答
204 浏览

php - 在 PHP 中替换 DOCX 的 MergeField

我有一个带有合并字段的 Word 模板 (DOCX) 和这个合并字段的许多条件。

例如 :

在此处输入图像描述

我想在 PHP 中完成合并字段。

我知道可以将数据源提供给 WORD 来执行此操作,但我不知道如何在 PHP 中执行此操作。

请问你有解决办法吗?

0 投票
1 回答
1729 浏览

vba - 如何使用 Word MailMerge 将合并字段插入到 VBA 中的 If..else 语句中?

下面的宏将输入字段标题,后跟字段值。If 语句应检查字段的值,如果大于 30,则给出实际值,否则为零。

如果它是真的,而不是出现的值,我只是得到我输入的实际文本,而不是它的值。

如果我需要澄清任何事情,请告诉我。

编辑:我从 excel 使用的示例数据

0 投票
1 回答
46 浏览

ms-word - 如何在单个 Microsoft Word 文档中存储不同的视图?

我想创建一个应用程序,允许用户在 word 文档中添加用户可读的文本,并在后端维护复杂的文本(语法),如 MergeField 或 Velocity 代码。例如简单的文本:你好,鲍勃先生。 复杂语法:Hello «#if($gender == 'Male' Mr. #{else} Ms. #end» Bob

这是否可以在单个 word 文档中同时维护简单的文本视图和复杂的语法视图

谢谢

0 投票
0 回答
532 浏览

c# - Openxmlsdk: Replace MergeField by html text

I'm using DocumentFormat.OpenXml to replace merge fields in my template docx file.

Step 1, I write method to find merge field

Step 2, I write method to replace html text

Code work well when after RemoveChild, the paragraph that contains merge field become empty. But if it still contains some element, the docx file after replace merge fields will corrupt. I've open docx file by xml tool, and see results are as follows: enter image description here

enter image description here

So, my question is, how can I replace a merge field inside a paragraph that contains another fields. Sorry for my English not good

0 投票
2 回答
152 浏览

excel - Word Document - Replace text in Header Table with Mergefields

I have a set of documents (lots) where the header in each has a table in the header with hardcoded address entries. I need to update all these documents to replace these hard-coded address with mergefields. The code is in an excel spreadsheet where the user selects the folder containing the documents to update. Below is an extract of where the updating is done e.g. trying to replace hardcoded value of 1 Maple Road with {MERGEFIELD Address_Line1}. Not sure where i'm going wrong but message is usually wrong number of arguments or does not work at all Thanks


Or tried

0 投票
2 回答
2311 浏览

line-breaks - 如何在合并字段中的每个项目之间放置换行符(出于格式化目的)

我有一个附加到我需要重新格式化的 SQL 查询的邮件合并。'action_name' 字段已插入并正常工作。[编辑:澄清一下,所有数据都出现在一个名为“action_name”的合并字段名称下]。

例如,它会出现在这样的字母中:

当然,每个人都会收到自己的信件,因此他们只会看到自己丢失的物品。

当我们把信交给其他部门时,他们每次都必须手动按回车键来重新格式化信,使其看起来像这样:

在这个例子中我只会做 PersonA。我想你应该已经明白了。

如何使用邮件合并(或 SQL 代码)中的代码执行此操作,以便其他人不必手动执行此操作?我已经知道 \v 垂直格式不适用于此。我读到它是针对东亚语言的。感谢您的任何提示!

0 投票
1 回答
1072 浏览

c# - 将 MergeField 更改为仅文本

我需要将文本替换为MergeField简单的文本。我发现有关该主题的问题。这个对我有用。此代码更改文本,但将字段保留为MergeField. 以及其他变成MergeField文本的问题。但如果一行中有多个这样的字段,则第二个将被删除。

在这一点上,我已经稍微调整了第一个链接中的代码。我需要添加什么来更改MergeField文本?

更新

我犯了一个错误。第二个链接上的代码。行中的第二个字段未删除。它留下来。但不落入循环,被忽略。我不明白为什么。

0 投票
0 回答
350 浏览

c# - 从 word doc 中的 MERGEFIELD 中删除空格

我创建了带有合并字段的 word doc。word doc 中的合并字段如下所示:

{ MERGEFIELD 测试值 }。

我需要做的是删除字段开头和结尾的空白。所以它应该是这样的:

{合并域测试值}。

我正在使用 Microsoft.Office.Interop.Word 来生成文档。

这是代码示例:

这是如何创建合并字段的代码示例

0 投票
1 回答
638 浏览

apache-poi - Apache POI 是否支持替换 docx 中的合并字段?

用 apache-poi 的值替换 ms word merge-fields 在段落和具有多列的表中。

由于 docx4j 提供了替换合并字段的功能,apache poi 是否有任何等效功能。由于我在 Docx 文件中使用了一些自定义标签,因此在 docx4j 中读取文件会忽略自定义标签(xml 格式“w:xyz”)。

输入模板

预期输出: