如何在word模板中重复相似的字段?

发布于 2024-09-18 05:54:30 字数 261 浏览 6 评论 0原文

我正在深入研究基于模板以编程方式编辑 Word 文档的领域。例如,如果模板中有一个“我的地址”部分,他们希望我过去的地址可以追溯到 5 年前,而我搬了 3 次,那么我将必须输入 3 个地址。显然这里的字段是完全相同的,但我希望每个字段都有不同的值。处理这个问题的最佳方法是什么?我想在后端 XML 文档中我希望看到 Address1、Address2、Address3 等等,但并不是每个人都会有 3 个地址。我是否应该在模板中只包含一个位置,并让我的代码注入地址的其他 XML 部分,并根据模板进行硬编码?

I am delving into the realm of programmatically editing a word document based on a template. If for example, the template had a section in it for My address, and they wanted my past addresses going back 5 years, and I have moved 3 times, I will have to put in 3 addresses. Obviously the fields here are exactly the same, but I want each of them to have different values. What is the best way to handle this? I guess in the back-end XML document I would expect to see Address1 Address2 Address3 and so on, but not everyone is going to have 3 addresses. Should I just have one location in the template, and make my code inject those other XML sections for an address, hardcoded based on the template?

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

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