重复内容的Office Open XML内容、Office、XML、Open

2023-09-03 22:56:30 作者:时光深处,你我安好

我已经检查出什么是可能的的Office Open XML规范文档。我在能够自定义XML的内容添加到文档并将其绑定到内容控件特别感兴趣。我想知道是否有可能有重复的内容控制型?

I've been checking out what is possible with the Office Open XML specification for documents. I'm particularly interested in being able to add custom XML content to a document and binding it to content controls. I was wondering if it is possible to have a repeating content control type?

举例来说,假设我有我的.docx文件的一些自定义XML看起来像这样:

For example, say I have some custom XML in my .docx file that looks like so:

<Work>
  .
  .
  <People>
    <Person>
      <Name>Jane Doe</Name>
      <EmailAddress>jane@abc.com</EmailAddress>
    </Person>
    <Person>
      <Name>John Doe</Name>
      <EmailAddress>john@xyz.com</EmailAddress>
    </Person>
  </People>
</Work>

有没有重复的内容控制(类似于ASP中继),我可以用它来生成输出,看起来像

Is there any repeating content control (similar to an ASP repeater) that I could use to generate output that looks something like

李四(jane@abc.com) 李四(john@xyz.com)

如果没有类型的控件,我想我可以做一些处理上的word文档本身生成一个列表。有没有人这样做,有一些有用的指针?

If there are no types of controls, I guess I could do some processing on the word document itself to generate a list. Has anyone done this and have some helpful pointers?

推荐答案

由于0xA3执行说,没有什么内建这样,这将是Wordpro​​cessingML中操纵的。但这里是拉动数据从数据库中创建多个条目的一个例子:从数据库将数据推到Word文档。

As 0xA3 says, there is nothing built-in like this, it would be WordprocessingML-manipulated. But here is an example of pulling data from a database to create multiple entries: Pushing Data from a Database into a Word Document.

此外,在数据绑定一般的主题,这里是一个很好的入门教程:链接的Word 2007内容控件添加到自定义XML 。

Also, on the subject of databinding in general, here is a good starter tutorial: Linking Word 2007 Content Controls to Custom XML.