Compartir a través de


BookmarkStart Class

Defines the BookmarkStart Class.When the object is serialized out as xml, its qualified name is w:bookmarkStart.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.BookmarkStart

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

Syntax

'Declaración
Public Class BookmarkStart _
    Inherits OpenXmlLeafElement
'Uso
Dim instance As BookmarkStart
public class BookmarkStart : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1ª edición]

17.13.3.2 bookmarkStart (Bookmark Start)

This element specifies the start of a bookmark within a WordprocessingML document. This start marker is matched with the appropriately paired end marker by matching the value of the id attribute from the associated bookmarkEnd element.

If no bookmarkEnd element exists subsequent to this element in document order with a matching id attribute value, then the document is non-conformant.

If a bookmark begins and ends within a single table, it is possible for that bookmark to cover discontiguous parts of that table which are logically related (e.g. a single column in a table). This kind of placement for a bookmark is accomplished (and described in detail) on the colFirst and colLast attributes on this element.

[Example: Consider a document with a bookmark which spans half of paragraph one, and part of paragraph two. The following WordprocessingML illustrates an example of content which fufills this constraint:

<w:p>
<w:r>
<w:t xml:space="preserve">This is sentence one.</w:t>
</w:r>
<w:bookmarkStart w:id="0" w:name="testing123"/>
<w:r>
<w:t>This is sentence two.</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t xml:space="preserve">This </w:t>
</w:r>
<w:bookmarkEnd w:id="0"/>
<w:r>
<w:t>is sentence three.</w:t>
</w:r>
</w:p>

The bookmarkStart element specifies the start of the region for the testing123 bookmark. This element is then linked to the bookmarkEnd element which also has an id attribute value of 0. end example]

Parent Elements

bdo (§17.3.2.3); body (§17.2.2); comment (§17.13.4.2); customXml (§17.5.1.6); customXml (§17.5.1.4); customXml (§17.5.1.5); customXml (§17.5.1.3); deg (§22.1.2.26); del (§17.13.5.14); den (§22.1.2.28); dir (§17.3.2.8); docPartBody (§17.12.6); e (§22.1.2.32); endnote (§17.11.2); fldSimple (§17.16.19); fName (§22.1.2.37); footnote (§17.11.10); ftr (§17.10.3); hdr (§17.10.4); hyperlink (§17.16.22); ins (§17.13.5.18); lim (§22.1.2.52); moveFrom (§17.13.5.22); moveTo (§17.13.5.25); num (§22.1.2.75); oMath (§22.1.2.77); p (§17.3.1.22); rt (§17.3.3.24); rubyBase (§17.3.3.27); sdtContent (§17.5.2.34); sdtContent (§17.5.2.33); sdtContent (§17.5.2.35); sdtContent (§17.5.2.36); smartTag (§17.5.1.9); sub (§22.1.2.112); sup (§22.1.2.114); tbl (§17.4.38); tc (§17.4.66); tr (§17.4.79)

Attributes

Description

colFirst (First Table Column Covered By Bookmark)

Specifies the zero-based index of the first column in this row which shall be part of this bookmark.

When a bookmark is contained within a table, it is possible for that bookmark to only cover cells within a certain column and row range within that table, by specifying:

  • The first row for which the specified columns are part of the table bookmark. This is accomplished by placing the bookmarkStart element in the first table cell in that row.

  • The first column included in the bookmark for each of the specified row(s) via this attribute.

  • The last column included in the bookmark for each of the specified row(s) via the colLast attribute.

  • The last row for which the specified columns are part of the table bookmark. This is accomplished by placing the bookmarkEnd element at the end of that table row.

If this attribute appears, then the colLast attribute shall also appear (regardless of where this bookmark is located) or the document shall be considered non-conformant. If this attibute and its pair occur on a bookmark which is not contained in a table, then their values should be ignored. If this value exceeds the value of colLast or the number of columns in the table, then both values should be ignored.

[Example: Consider a three row by three column table where a table bookmark must be applied to the contents of the first two cells in the first two rows in the table (the cells shaded below):

This bookmark would be specified using the following WordprocessingML for the table's conents:

<w:tbl>
…
<w:tr>
<w:tc>
<w:bookMarkStart w:colFirst="0" w:colLast="1" w:id="0" w:name="table"/>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
    <w:bookmarkEnd w:id="0" />
</w:tr>
<w:tr>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
</w:tr>
</w:tbl>

The colFirst attribute specifies that all columns starting with the first column must be included in the table bookmark. This applies starting with the first row and ending with the second row (the two rows within the bookmark's start and end). end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

colLast (Last Table Column Covered By Bookmark)

Specifies the zero-based index of the last column in this row which shall be part of this bookmark.

When a bookmark is contained within a table, it is possible for that bookmark to only cover cells within a certain column and row range within that table, by specifying:

  • The first row for which the specified columns are part of the table bookmark. This is accomplished by placing the bookmarkStart element in the first table cell in that row.

  • The first column included in the bookmark for each of the specified row(s) via the colFirst attribute.

  • The last column included in the bookmark for each of the specified row(s) via this attribute.

  • The last row for which the specified columns are part of the table bookmark. This is accomplished by placing the bookmarkEnd element at the end of that table row.

If this attribute appears, then the colFirst attribute shall also appear (regardless of where this bookmark is located) or the document shall be considered non-conformant. If this attibute and its pair occur on a bookmark which is not contained in a table, then their values should be ignored. If this value does not equal or exceed the value of colFirst or the number of columns in the table, then both values should be ignored.

[Example: Consider a three row by three column table where a table bookmark shall be applied to the contents of the first two cells in the first two rows in the table (the cells shaded below):

This bookmark would be specified using the following WordprocessingML for the table's conents:

<w:tbl>
…
<w:tr>
<w:tc>
<w:bookMarkStart w:colFirst="0" w:colLast="1" w:id="0" w:name="table"/>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
    <w:bookmarkEnd w:id="0" />
</w:tr>
<w:tr>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
<w:tc>
<w:p/>
</w:tc>
</w:tr>
</w:tbl>

The colLast attribute specifies that the last column that shall be included in the table bookmark is the second column. This applies starting with the first row and ending with the second row (the two rows within the bookmark's start and end). end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

displacedByCustomXml (Annotation Marker Relocated For Custom XML Markup)

Specifies that the parent annotation's placement shall be directly linked with the location of the physical presentation of a custom XML element in the document. This element only has an effect when the custom XML element is block-level (i.e. surrounds an entire paragraph), as in this scenario the logical and physical placement of the annotation and custom XML element can differ.

Specifically, in this case, the custom XML is presented *around* the block-level object it encloses (the paragraph, table, table row, or table cell), but is physically represented within that same object (i.e. within the paragraph, table, table row or table cell). This requirement stems from the fact that there is no location for the location of the annotation within the document at its logical location (around a table, for example).

If this element is omitted, then the annotation shall be anchored inside of all block-level custom XML elements in the paragraph. If this element is present, but no block-level custom XML tag is located at the position it specifies (before or after), then it shall be ignored.

[Example: Consider a paragraph with block level custom XML markup and two comment anchor annotations (one before and one after the custom XML element's physical representation), as follows:

DocumentFormat.OpenXml.Wordprocessing.BookmarkStar

Since all three of these items are around the entire paragraph, they are stored outside of the paragraph. However, in order to ensure that their relative positions are stored correctly, any annotation which must be displaced by the physical custom XML element specifies this information, resulting in the following WordprocessingML:

…
<w:commentRangeStart w:id="0" />
<w:commentRangeStart w:id="1" w:displaced byCustomXml="next" />
<w:customXml w:element="spec" … />
<w:p>
…
</w:p>
…

The displacedByCustomXml attribute specifies that even though all three of these items are around the paragraph and is moved inside the paragraph to be represented physically, the comment with ID 0 must be inside the custom XML, but the comment with ID 1 must be displaced to stay outside of the relative location of the next custom XML element (the spec element). end example]

The possible values for this attribute are defined by the ST_DisplacedByCustomXml simple type (§17.18.13).

id (Annotation Identifier)

Specifies a unique identifier for an annotation within a WordprocessingML document. The restrictions on the id attribute, if any, are defined by the parent XML element.

If this attribute is omitted, then the document is non-conformant.

[Example: Consider an annotation represented using the following WordprocessingML fragment:

<… w:id="1" … >
  …
</…>

The id attribute specifies that the ID of the current annotation is 1. This value is used to uniquely identify this annotation within the document content. end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

name (Bookmark Name)

Specifies the bookmark name.

If multiple bookmarks in a document share the same name, then the first bookmark (defined by the location of the bookmarkStart element in document order) shall be maintained, and all subsequent bookmarks should be ignored.

[Example: Consider the following XML for a bookmark around a single word:

<w:p>
<w:bookmarkStart w:id="0" w:name="place" />
<w:r>
<w:t>Seattle</w:t>
</w:r>
<w:bookmarkEnd w:id="0" />
</w:p>

The name attribute specifies that the name for this bookmark is place. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

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

© ISO/IEC29500: 2008. Los extractos anteriores han sido traducidos del inglés al español por Microsoft (o algunos de sus agentes) e ISO no asume ningún tipo de responsabilidad por dichas traducciones.

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

BookmarkStart Members

DocumentFormat.OpenXml.Wordprocessing Namespace