共用方式為


DataBar Class

Defines the DataBar Class.This class is only available in Office2010.When the object is serialized out as xml, its qualified name is x14:dataBar.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Office2010.Excel.DataBar

Namespace:  DocumentFormat.OpenXml.Office2010.Excel
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(NegativeBorderColor), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(FillColor), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(BorderColor), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(NegativeFillColor), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(ConditionalFormattingValueObject), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(BarAxisColor), FileFormatVersions.Office2010)> _
<OfficeAvailabilityAttribute(FileFormatVersions.Office2010)> _
Public Class DataBar _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As DataBar
[ChildElementInfoAttribute(typeof(NegativeBorderColor), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(FillColor), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(BorderColor), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(NegativeFillColor), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(ConditionalFormattingValueObject), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(BarAxisColor), FileFormatVersions.Office2010)]
[OfficeAvailabilityAttribute(FileFormatVersions.Office2010)]
public class DataBar : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • ConditionalFormattingValueObject <x14:cfvo>

  • FillColor <x14:fillColor>

  • BorderColor <x14:borderColor>

  • NegativeFillColor <x14:negativeFillColor>

  • NegativeBorderColor <x14:negativeBorderColor>

  • BarAxisColor <x14:axisColor>

2.6.30 CT_DataBar

Target namespace: https://schemas.microsoft.com/office/spreadsheetml/2010/main

Referenced by: CT_CfRule

A complex type that specifies a data bar used in conditional formatting.

Child Elements:

cfvo : A CT_Cfvo element that specifies the cell values corresponding to the min/max length of the data bar. If there exist CT_Cfvo ([ISO/IEC-29500-4] section A.2) elements in this sheet that are children of a CT_DataBar ([ISO/IEC-29500-4] section A.2) element that is a child of a CT_CfRule ([ISO/IEC-29500-4] section A.2) element that is a parent of a CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element with a child CT_Extension ([ISO/IEC-29500-4] section A.2) element that has a child ST_Guid ([ISO/IEC-29500-4] section A.2) element equal to the id attribute of this complex type’s parent CT_CfRule element, then those CT_Cfvo ([ISO/IEC-29500-4] section A.2) elements SHOULD<27> be ignored. The first child CT_Cfvo element specifies the condition corresponding to the min length of the data bar. The second child CT_Cfvo element specifies the condition corresponding to the max length of the data bar.

fillColor : A CT_Color ([ISO/IEC-29500-4] section A.2) element that specifies the fill color of the data bar. This element MUST exist if and only if the priority attribute of the CT_CfRule that is a parent of this complex type exists.

borderColor : A CT_Color ([ISO/IEC-29500-4] section A.2) element that specifies the border color of the data bar. This element MUST exist if and only if border equals TRUE.

negativeFillColor : A CT_Color ([ISO/IEC-29500-4] section A.2) element that specifies the negative fill color of the data bar. This element MUST exist if and only if negativeBarColorSameAsPositive equals FALSE.

negativeBorderColor : A CT_Color ([ISO/IEC-29500-4] section A.2) element that specifies the negative border color of the data bar. This element MUST exist if and only if negativeBarBorderColorSameAsPositive equals FALSE and border equals TRUE.

axisColor : A CT_Color ([ISO/IEC-29500-4] section A.2) element that specifies the axis color of the data bar. This element MUST exist if and only if axisPosition does not equal none.

Attributes:

minLength : An unsignedInt ([XMLSCHEMA2] section 3.3.22) attribute that specifies the length of the shortest data bar in this conditional formatting range, expressed as a percentage of the width of the cell containing the data bar. MUST be greater than or equal to 0 and less than or equal to maxLength. If in this same worksheet part there exists a CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a descendent of a CT_CfRule ([ISO/IEC-29500-4] section A.2) with a child CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element equal to the id attribute of the CT_CfRule element that is a parent of this element, and the minLength attribute of this element is 0 and the maxLength attribute of this element is 100, then the minLength attribute of the CT_DataBar ([ISO/IEC-29500-4] section A.2) element that is a descendent of the CT_CfRule ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element equal to the id attribute of the CT_CfRule element that is a parent of this element MUST be 10. If in this same worksheet part there exists an CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a descendent of a CT_CfRule ([ISO/IEC-29500-4] section A.2) with a child CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element equal to the id attribute of the CT_CfRule element that is a parent of this element, and the minLength attribute of this element is not 0 or the maxLength attribute of this element is not 100, then the minLength attribute of the CT_DataBar ([ISO/IEC-29500-4] section A.2) element that is a descendent of the CT_CfRule ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element that is equal to the id attribute of the CT_CfRule element that is a parent of this element MUST be equal to this complex type’s minLength<28>.

maxLength : An unsignedInt ([XMLSCHEMA2] section 3.3.22) attribute that specifies the length of the longest data bar in this conditional formatting range, expressed as a percentage of the width of the cell being formatted. MUST be greater than or equal to minLength and less than or equal to 100. If in this same worksheet part there exists a CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a descendent of a CT_CfRule ([ISO/IEC-29500-4] section A.2) with a child CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element equal to the id attribute of the CT_CfRule element that is a parent of this element, and the minLength attribute of this element is 0 and the maxLength attribute of this element is 100, then the maxLength attribute of the CT_DataBar ([ISO/IEC-29500-4] section A.2) element that is a descendent of the CT_CfRule ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element that is equal to the id attribute of the CT_CfRule element that is a parent of this element MUST be 90. If in this same worksheet part there exists a CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a descendent of a CT_CfRule ([ISO/IEC-29500-4] section A.2) with a child CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element equal to the id attribute of the CT_CfRule element that is a parent of this element, and the minLength attribute of this element is not 0 or the maxLength attribute of this element is not 100, then the maxLength attribute of the CT_DataBar ([ISO/IEC-29500-4] section A.2) element that is a descendent of the CT_CfRule ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that is a parent of the CT_Extension ([ISO/IEC-29500-4] section A.2) element with child ST_Guid ([ISO/IEC-29500-4] section A.2) element that is equal to the id attribute of the CT_CfRule element that is a parent of this element MUST be equal to this record’s maxLength<29>.

showValue : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies whether the cells in the conditional formatting range display both the data bar and the numeric value or only the data bar.

Value

Meaning

FALSE

Only the data bar is displayed in the cell

TRUE

Both the data bar and the numeric value are displayed in the cell

border : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies whether the data bar has a border.

gradient : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies whether the data bar has a gradient fill*.*

Value

Meaning

FALSE

The data bar fill is a solid color.

TRUE

The data bar fill is a gradient.

direction : An ST_DataBarDirection attribute that specifies the direction of the data bar.

negativeBarColorSameAsPositive : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies whether the data bar has a negative bar color that is different than the positive bar color.

negativeBarBorderColorSameAsPositive : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies whether the data bar has a negative border color that is different than the positive border color.

axisPosition : An ST_DataBarAxisPosition attribute that specifies the axis position for the data bar.

The following W3C XML Schema ([XMLSCHEMA1] section 2.1) fragment specifies the contents of this complex type.

<xsd:complexType name="CT_DataBar">

<xsd:sequence>

<xsd:element name="cfvo" type="CT_Cfvo" minOccurs="2" maxOccurs="2"/>

<xsd:element name="fillColor" type="x:CT_Color" minOccurs="0" maxOccurs="1"/>

<xsd:element name="borderColor" type="x:CT_Color" minOccurs="0" maxOccurs="1"/>

<xsd:element name="negativeFillColor" type="x:CT_Color" minOccurs="0" maxOccurs="1"/>

<xsd:element name="negativeBorderColor" type="x:CT_Color" minOccurs="0" maxOccurs="1"/>

<xsd:element name="axisColor" type="x:CT_Color" minOccurs="0" maxOccurs="1"/>

</xsd:sequence>

<xsd:attribute name="minLength" type="xsd:unsignedInt" use="optional" default="10"/>

<xsd:attribute name="maxLength" type="xsd:unsignedInt" use="optional" default="90"/>

<xsd:attribute name="showValue" type="xsd:boolean" use="optional" default="true"/>

<xsd:attribute name="border" type="xsd:boolean" use="optional" default="false"/>

<xsd:attribute name="gradient" type="xsd:boolean" use="optional" default="true"/>

<xsd:attribute name="direction" type="ST_DataBarDirection" use="optional" default="context"/>

<xsd:attribute name="negativeBarColorSameAsPositive" type="xsd:boolean" use="optional" default="false"/>

<xsd:attribute name="negativeBarBorderColorSameAsPositive" type="xsd:boolean" use="optional" default="true"/>

<xsd:attribute name="axisPosition" type="ST_DataBarAxisPosition" use="optional" default="automatic"/>

</xsd:complexType>

See section 5.3 for the full W3C XML Schema ([XMLSCHEMA1] section 2.1).

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

DataBar Members

DocumentFormat.OpenXml.Office2010.Excel Namespace