共用方式為


Slicer Class

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

Inheritance Hierarchy

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

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

Syntax

'Declaration
<OfficeAvailabilityAttribute(FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(ExtensionList), FileFormatVersions.Office2010)> _
Public Class Slicer _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Slicer
[OfficeAvailabilityAttribute(FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(ExtensionList), FileFormatVersions.Office2010)]
public class Slicer : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • ExtensionList <x14:extLst>

2.6.62 CT_Slicer

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

Referenced by: CT_Slicers

A complex type that specifies a slicer view in this worksheet.

Child Elements:

extLst : A CT_ExtensionList ([ISO/IEC-29500-4] section A.2) element that specifies future extensibility for this element.

Attributes:

name : An ST_Xstring ([ISO/IEC-29500-1] section 22.9.2.19) attribute that specifies the name of the slicer view. MUST be a unique case insensitive name within the scope of this workbook. The length of this attribute MUST be greater than or equal to 1 character and MUST be less than or equal to 32767 characters.

cache : An ST_Xstring ([ISO/IEC-29500-1] section 22.9.2.19) attribute that specifies the name of the slicer cache that this slicer view is associated with. There MUST be a CT_SlicerCacheDefinition element within this workbook with the name attribute equal to the value of this attribute.

caption : An ST_Xstring ([ISO/IEC-29500-1] section 22.9.2.19) attribute that specifies the caption of the slicer view. If this string exists, the length MUST be greater than or equal to 1 character.

startItem : An unsignedInt ([XMLSCHEMA2] section 3.3.22) attribute that specifies the zero-based index of the first slicer item displayed by the slicer view.

columnCount : An unsignedInt ([XMLSCHEMA2] section 3.3.22) attribute that specifies the number of columns in the slicer view. MUST be greater than or equal to 1 and MUST be less than or equal to 20000.

showCaption : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies whether the caption in displayed.

level : An unsignedInt ([XMLSCHEMA2] section 3.3.22) attribute that specifies the OLAP level of the OLAP hierarchy of the slicer source data used by this slicer view.

If the slicer source data is OLAP, then the value MUST be greater than or equal to 0 and MUST be less than count of the CT_OlapSlicerCacheLevelsData element specified by the CT_SlicerCacheDefinition element specified by cache. If the OLAP hierarchy has an OLAP All level, then the value MUST NOT be 0.

If the slicer source data is non-OLAP, then this attribute MUST NOT exist.

style : An ST_Xstring ([ISO/IEC-29500-1] section 22.9.2.19) attribute that specifies the slicer style of the slicer view. If this field exists, this string MUST match the name attribute of a CT_SlicerStyle element within this workbook or MUST be equal to one of the built-in slicer style names:

Built-In Slicer Styles Names

SlicerStyleLight1

SlicerStyleLight2

SlicerStyleLight3

SlicerStyleLight4

SlicerStyleLight5

SlicerStyleLight6

SlicerStyleOther1

SlicerStyleOther2

SlicerStyleDark1

SlicerStyleDark2

SlicerStyleDark3

SlicerStyleDark4

SlicerStyleDark5

SlicerStyleDark6

lockedPosition : A boolean ([XMLSCHEMA2] section 3.2.2) attribute that specifies if the slicer view is locked.

rowHeight : An unsignedInt ([XMLSCHEMA2] section 3.3.22) attribute that specifies the row height of the slicer view in EMUs.

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

<xsd:complexType name="CT_Slicer">

<xsd:sequence>

<xsd:element name="extLst" type="x:CT_ExtensionList" minOccurs="0" maxOccurs="1"/>

</xsd:sequence>

<xsd:attribute name="name" type="x:ST_Xstring" use="required"/>

<xsd:attribute name="cache" type="x:ST_Xstring" use="required"/>

<xsd:attribute name="caption" type="x:ST_Xstring" use="optional"/>

<xsd:attribute name="startItem" type="xsd:unsignedInt" use="optional" default="0"/>

<xsd:attribute name="columnCount" type="xsd:unsignedInt" use="optional" default="1"/>

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

<xsd:attribute name="level" type="xsd:unsignedInt" use="optional" default="0"/>

<xsd:attribute name="style" type="x:ST_Xstring" use="optional"/>

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

<xsd:attribute name="rowHeight" type="xsd:unsignedInt" use="required"/>

</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

Slicer Members

DocumentFormat.OpenXml.Office2010.Excel Namespace