Table of contents
TOC
折叠目录
展开目录

客户对象 (PowerPoint)CustomerData Object (PowerPoint)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

将 (如名称、 地址、 电话号码等) 的客户信息或其他信息以 XML 形式存储为CustomXMLPart与 Microsoft PowerPoint 对象关联的对象的集合。Stores information about a customer (such as name, address, telephone number, and so on) or other information in XML form, as a collection of CustomXMLPart objects associated with a Microsoft PowerPoint object.

注解Remarks

您可以将客户数据存储在CustomLayout主机演示文稿形状,以及幻灯片对象。可以将一个或多个CustomXMLPart对象具有相同的对象相关联。You can store customer data in CustomLayout, Master, Presentation, Shape, and Slide objects. You can associate one or more CustomXMLPart objects with the same object.

  • 客户数据从一个实例保持到 PowerPoint 文档中的下一个仅当您将文档保存为 XML PowerPoint 演示文稿的 XML 文件格式中。客户数据不能持续以.ppt、.htm 或.mht 格式保存的文档中。Customer data persists from one instance to the next in a PowerPoint document only when you save the document in XML file format, as a PowerPoint XML presentation. Customer data does not persist in documents saved in .ppt, .htm, or .mht formats.

  • PowerPoint 中没有与客户数据相关的用户界面。分配和操作客户数据的唯一方法是通过编程来实现。There is no user interface associated with customer data in PowerPoint. The only way that you can assign and manipulate customer data is programmatically.

使用Add方法向客户集合中添加一个新的CustomXMLPart对象。Use the Add method to add a new CustomXMLPart object to the CustomerData collection.

使用Delete方法从客户集合中删除一个CustomXMLPart对象。Use the Delete method to delete a CustomXMLPart object from the CustomerData collection.

使用Item方法可从集合中获取指定的CustomXMLPart对象。由 Guid (全局唯一标识符) 表示集合中的单个项。Use the Item method to get a specific CustomXMLPart object from the collection. Individual items in the collection are represented by GUIDs (globally unique identifiers).

您可以使用客户数据方式的 Microsoft Office PowerPoint 2007-亦即之前的 PowerPoint 版本中使用标记对象与对象关联的数据完全相同。客户数据是比功能更强大标记,但是,因为您可以将数据存储为 XML 而不是作为一个简单的字符串。You can use customer data in the same way that you used Tags objects in versions of PowerPoint previous to Microsoft Office PowerPoint 2007--that is, to associate data with objects. Customer data is more powerful than tags, however, because you can store the data as XML instead of as a simple string.

可以通过在电子表格或数据库中将自定义 XML 部件的 ID 与外部数据存储在一起,将 PowerPoint 中的客户数据与外部数据相关联。You can associate customer data in PowerPoint with external data by storing the IDs of custom XML parts in a spreadsheet or database along with the external data.

当您复制一个对象,包含客户数据时,客户数据被复制到新对象。PowerPoint 会创建一个新的CustomXMLPart对象来保存所复制的数据,因为两个CustomLayout主服务器演示文稿形状幻灯片对象永远不能与同一CustomXMLPart对象。When you copy an object that contains customer data, the customer data is copied to the new object. PowerPoint creates a new CustomXMLPart object to hold the copied data, because two CustomLayout, Master, Presentation, Shape, or Slide objects can never be associated with the same CustomXMLPart object.

示例Example

下面的示例演示如何将CustomXMLPart对象添加到当前演示文稿第一张幻灯片第一个形状的客户集合,以及如何将 XML 字符串加载到自定义 XML 部件。它输出的自定义 XML 部件,并在立即窗口中的 XML 字符串的 ID。The following example shows how to add a CustomXMLPart object to the CustomerData collection of the first shape on the first slide of the active presentation, and how to load an XML string into the custom XML part. It prints the ID of the custom XML part and the XML string in the Immediate window.

Public Sub CustomerData_Example() 

    Dim pptCustomXMLPart As CustomXMLPart 

    Set pptCustomXMLPart = ActivePresentation.Slides(1).Shapes(1).customerData.Add 

    Debug.Print pptCustomXMLPart.Id 

    pptCustomXMLPart.LoadXML ("<Customer><CustomerID>Customer #1</CustomerID></Customer>") 

    Debug.Print pptCustomXMLPart.xml 

End Sub

另请参阅See also

概念Concepts

PowerPoint 对象模型引用PowerPoint Object Model Reference

© 2018 Microsoft