Captions Class

Caption Settings.When the object is serialized out as xml, its qualified name is w:captions.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.Captions

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(AutoCaptions))> _
<ChildElementInfoAttribute(GetType(Caption))> _
Public Class Captions _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Captions
[ChildElementInfoAttribute(typeof(AutoCaptions))]
[ChildElementInfoAttribute(typeof(Caption))]
public class Captions : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • Caption <w:caption>

  • AutoCaptions <w:autoCaptions>

[ISO/IEC 29500-1 1st Edition]

17.15.1.17 captions (Caption Settings)

This element specifies the presence of information about captionsin a given WordprocessingML document. This information is divided into two components:

  • The child element caption defines the format for a single type of caption to be automatically added to the document.

  • The child element autoCaptions defines the types of objects to which a caption format shall automatically be applied.

This information should be used to determine the captions which are automatically added to objects when they are inserted into a WordprocessingML document. [Note: This setting is typically ignored unless it is specified in an application's default template. end note]

[Example: Consider the diagram below illustrating a WordprocessingML document containing a table that has been labeled with a caption:

DocumentFormat.OpenXml.Wordprocessing.Captions-ima

In this diagram, the table contained in the WordprocessingML document has been labeled by inserting a caption below the table consisting of the string Table followed by a decimal number. This automatically inserted caption format is specified using the following WordprocessingML:

<w:captions>
  <w:caption w:name="Table" w:pos="below" w:numFmt="decimal" /> 
</w:captions>

Here, the captions element specifies the presence of one or more caption formatsin a given WordprocessingML document with its child element caption. Specifically, the child element caption specifies a single type of caption to be used within the WordprocessingML document. end example]

Captioning leverages fields (§17.16.5) to label objects with reference to either:

  • Other captioned objects within a given document

  • Other captioned objects within the same chapter in a given document (when chapter numbers are added by specifiying the chapNum attribute on the caption type. A chapter is a section of text within a WordprocessingML document that is preceded by content with a style that has been specified by to demarcate chapters in documents. Only one style can be specified as the style used for a single caption type to demarcate chapters in a document. A chapter ends immediately above the next instance of content with the style used to demarcate chapters.

[Example: Consider the diagram below:

DocumentFormat.OpenXml.Wordprocessing.Captions-imaDocumentFormat.OpenXml.Wordprocessing.Captions-ima

This diagram depicts a WordprocessingML document containing two chapters, each containing two tables labeled with captions. The style associated with chapter demarcation has been applied to the strings: Chapter 1 - FY02 and Chapter 2 - FY03 in this document. Specifically, the style used to demarcate chapters is the style with its styleID attribute equal to Heading2 as specified by the heading attribute value of 2 in the WordprocessingML for the caption format:

<w:caption w:name="Table" w:pos="below" w:chapNum="1" w:heading="2" w:numFmt="upperLetter" w:sep="8212" /> 

In other words, the WordprocessingML above can be used to label objects (in this case, tables) inserted in a given WordprocessingML document generated by an application with a caption consisting of: the string Table followed by a decimal number corresponding with the chapter number in which the table is present, a hyphen, and a capital English letter corresponding with the given table's index within the given chapter. end example]

[Note: WordprocessingML is designed such that the caption element can be used in conjunction with applications to provide a dynamic captioning experience. In other words, an application can use the WordprocessingML in the example above to automatically insert a caption consisting of the string Table followed by an incrementing decimal number field below tables when tables are inserted into a WordprocessingML document as defined by the autoCaption element (§17.15.1.7). end note]

Parent Elements

settings (§17.15.1.78)

Child Elements

Subclause

autoCaptions (Automatic Captioning Settings)

§17.15.1.8

caption (Single Caption Type Definition)

§17.15.1.16

[Note: The W3C XML Schema definition of this element’s content model (CT_Captions) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Captions Members

DocumentFormat.OpenXml.Wordprocessing Namespace