如何在word模板中重复相似的字段?
我正在深入研究基于模板以编程方式编辑 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅 http://dbe.codeplex.com/Thread/View.aspx?ThreadId =219510
或 http://dev.plutext.org /svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.docx
See http://dbe.codeplex.com/Thread/View.aspx?ThreadId=219510
or http://dev.plutext.org/svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.docx