次の方法で共有


Div Class

Information About Single HTML div Element.When the object is serialized out as xml, its qualified name is w:div.

Inheritance Hierarchy

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

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

Syntax

'宣言
<ChildElementInfoAttribute(GetType(BottomMarginDiv))> _
<ChildElementInfoAttribute(GetType(BlockQuote))> _
<ChildElementInfoAttribute(GetType(BodyDiv))> _
<ChildElementInfoAttribute(GetType(LeftMarginDiv))> _
<ChildElementInfoAttribute(GetType(RightMarginDiv))> _
<ChildElementInfoAttribute(GetType(TopMarginDiv))> _
<ChildElementInfoAttribute(GetType(DivBorder))> _
<ChildElementInfoAttribute(GetType(DivsChild))> _
Public Class Div _
    Inherits OpenXmlCompositeElement
'使用
Dim instance As Div
[ChildElementInfoAttribute(typeof(BottomMarginDiv))]
[ChildElementInfoAttribute(typeof(BlockQuote))]
[ChildElementInfoAttribute(typeof(BodyDiv))]
[ChildElementInfoAttribute(typeof(LeftMarginDiv))]
[ChildElementInfoAttribute(typeof(RightMarginDiv))]
[ChildElementInfoAttribute(typeof(TopMarginDiv))]
[ChildElementInfoAttribute(typeof(DivBorder))]
[ChildElementInfoAttribute(typeof(DivsChild))]
public class Div : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • BlockQuote <w:blockQuote>

  • BodyDiv <w:bodyDiv>

  • LeftMarginDiv <w:marLeft>

  • RightMarginDiv <w:marRight>

  • TopMarginDiv <w:marTop>

  • BottomMarginDiv <w:marBottom>

  • DivBorder <w:divBdr>

  • DivsChild <w:divsChild>

[ISO/IEC 29500-1 初版]

17.15.2.6 div (Information About Single HTML div Element)

This element specifies information about a single HTML div, body, or blockquote element which was included in this document, so that that information (which is stored on a logical structure with no direct analog in WordprocessingML) can be maintained when an HTML document is stored in the WordprocessingML format.

The div element stores the following information about these structures:

  • The child HTML div, and blockquote elements

  • The borders for the element

  • The margins for the element

When the resulting WordprocessingML document is displayed by an application, the settings specified by this information shall be reflected in the formatting of the resulting paragraphs (i.e. this information shall not only be used when the document is resaved in the HTML format).

[Example: Consider a simple HTML document defined as follows:

<html>
<body>
<div style="border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; margin-left: 50px">
<p>Paragraph one.</p>
<p>Paragraph two.</p>
</div>
</body>
</html>

This HTML would therefore normally appear as follows (image scaled appropriately):

DocumentFormat.OpenXml.Wordprocessing.Div-image001

Now, when this document is saved in the WordprocessingML format, the information stored on the div, blockquote, and body elements is stored in the web setting part as follows:

<w:divs>
<w:div w:id="1785730240">
<w:marLeft w:val="750" />
…
<w:divBdr>
<w:left w:val="single" w:sz="6" w:color="auto" />
<w:right w:val="single" w:sz="6" w:color="auto" />
</w:divBdr>
</w:div>
</w:divs>

The div element specifies all margin and border information about the single HTML div structures in the document; in this case, the left indentation and the left and right borders. end example]

Parent Elements

divs (§17.15.2.8); divsChild (§17.15.2.9)

Child Elements

Subclause

blockQuote (Data for HTML blockquote Element)

§17.15.2.2

bodyDiv (Data for HTML body Element)

§17.15.2.3

divBdr (Set of Borders for HTML div)

§17.15.2.7

divsChild (Child div Elements Contained within Current div)

§17.15.2.9

marBottom (Bottom Margin for HTML div)

§17.15.2.24

marLeft (Left Margin for HTML div)

§17.15.2.26

marRight (Right Margin for HTML div)

§17.15.2.27

marTop (Top Margin for HTML div)

§17.15.2.28

Attributes

Description

id (div Data ID)

Specifies a unique decimal number which shall be used to associate one or more structures in the WordprocessingML content with this HTML div information.

When a WordprocessingML structure (a paragraph or a table row) is associated with div information, it shall be associated with the set of information which most immediately contains the current object.

[Example: If a paragraph is wrapped within two HTML div elements, like this:

<div>
<div>
<p>Paragraph</p>
</div>
</div>

The resulting WordprocessingML paragraph must reference the div Data ID associated with the inner HTML div element - the fact that it is also contained within the outer HTML div must be implied by the nesting of the corresponding WordprocessingML div elements in the web settings part. end example]

The ID specified by this attribute is then referenced by the divId element for all structures which are immediately contained within the specified HTML div.

[Example: Consider a simple HTML document defined as follows:

<html>
<body style=" margin-top:50px">
<p>Paragraph one.</p>
<div style="margin-left:50px">
<p>Paragraph two.</p>
</div>
</body>
</html>

If the outer and inner body and div elements were assigned id attributes as follows:

<w:divs>
<w:div w:id="1626542603">
<w:bodyDiv w:val="1" />
…
<w:divsChild>
<w:div w:id="313534916">
…
</w:div>
</w:divsChild>
</w:div>
</w:divs>

Then the first paragraph would reference the div ID of the outer div (since it is contained by the HTML body element) and the second paragraph would reference the div ID of the inner div (since it is contained within the child HTML div element), as follows:

<w:p>
<w:pPr>
<w:divId w:val="1626542603" />
</w:pPr>
<w:r>
<w:t>Paragraph one.</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:divId w:val="313534916" />
</w:pPr>
<w:r>
<w:t>Paragraph one.</w:t>
</w:r>
</w:p>

The id attributes on the div elements link each paragraph with the corresponding container div element. end example]

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

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

© ISO/IEC29500: 2008. 上記の引用はマイクロソフト (またはその代理) によって英語から日本語に翻訳されたものであり、ISO はこうした翻訳に対する責任を一切負いません。

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

Div Members

DocumentFormat.OpenXml.Wordprocessing Namespace