XML Spreadsheet Reference
XML Spreadsheet Reference
Michael Stowe
Microsoft Corporation
August 2001
Applies to:
Microsoft® Excel 2002
Microsoft® Office XP Web Components Spreadsheet Component
Summary: This reference describes the elements and attributes that make up the XML Spreadsheet (XMLSS) schema
when the data in Microsoft Excel 2002 spreadsheets and Microsoft Office XP Spreadsheet Components is exported to the
Extensible Markup Language (XML) format. (53 printed pages)
Contents
To use this reference, click on the hyperlinked tag you're interested in as listed in the Contents section above. The easiest
way to see how these tags relate to each other is to export the data in a Microsoft® Excel 2002 spreadsheet or
Microsoft® Office XP Spreadsheet Component to the XML Spreadsheet (XMLSS) format and cross-reference the output
against the tags listed here.
To save the data from an Excel 2002 spreadsheet in the XMLSS format, on the File menu, click Save As. In the Save As
list, click XML Spreadsheet (*.xml). Type a file name into the File name list, and then click Save. Then open the XML
file in Microsoft® Internet Explorer 5 or later to examine the XMLSS output.
To save the data from an Office XP Spreadsheet Component in the XMLSS format, click the Export to Microsoft Excel
button on the Spreadsheet Component's toolbar, and then follow the directions above to save the Excel 2002
spreadsheet's contents as XML.
Copy Code
<ss:Workbook>
<ss:Styles>
<ss:Style>
<ss:Alignment/>
<ss:Borders>
<ss:Border/>
</ss:Borders>
<ss:Font/>
<ss:Interior/>
<ss:NumberFormat/>
<ss:Protection/>
</ss:Style>
</ss:Styles>
<ss:Names>
<ss:NamedRange/>
</ss:Names>
<ss:Worksheet>
<ss:Names>
<ss:NamedRange/>
</ss:Names>
<ss:Table>
<ss:Column/>
<ss:Row>
<ss:Cell>
<ss:NamedCell/>
<ss:Data>
<Font/>
<B/>
<I/>
<U/>
<S/>
<Sub/>
<Sup/>
<Span/>
</ss:Data>
<x:PhoneticText/>
<ss:Comment>
<ss:Data>
<Font/>
<B/>
<I/>
<U/>
<S/>
<Sub/>
<Sup/>
<Span/>
</ss:Data>
</ss:Comment>
<o:SmartTags>
<stN:SmartTag/>
</o:SmartTags>
</ss:Cell>
</ss:Row>
</ss:Table>
<c:WorksheetOptions>
<c:DisplayCustomHeaders/>
</c:WorksheetOptions>
<x:WorksheetOptions>
<x:PageSetup>
<x:Layout/>
<x:PageMargins/>
<x:Header/>
<x:Footer/>
</x:PageSetup>
</x:WorksheetOptions>
<x:AutoFilter>
<x:AutoFilterColumn>
<x:AutoFilterCondition/>
<x:AutoFilterAnd>
<x:AutoFilterCondition/>
</x:AutoFilterAnd>
<x:AutoFilterOr>
<x:AutoFilterCondition/>
</x:AutoFilterOr>
</x:AutoFilterColumn>
</x:AutoFilter>
</ss:Worksheet>
<c:ComponentOptions>
<c:Toolbar>
<c:HideOfficeLogo/>
</c:Toolbar>
</c:ComponentOptions>
<o:SmartTagType/>
</ss:Workbook>
<B> Tag
Description
Specifies a change to bold within an Excel rich-text data stream.
<c:ComponentOptions> Tag
Description
This element contains information that is unique to the Spreadsheet component. Excel does not need to read or
understand this information.
<c:DisplayCustomHeaders> Tag
Description
Presence of this element indicates that the Spreadsheet component should display custom row and column headers for
this sheet, rather than the default "A, B, C..." and "1, 2, 3..." style row and column headers.
<c:HideOfficeLogo> Tag
Description
Presence of this element indicates that the Office logo should be hidden. The default state is to show the Office logo,
hence the name HideOfficeLogo.
<c:Toolbar> Tag
Optional Attributes
Attribute: ss:Hidden
Type: Boolean
<c:WorksheetOptions> Tag
Description
This element contains worksheet options that are specific to the Spreadsheet component.
<Font> Tag
Description
Specifies a font change within an Excel rich-text data stream.
Optional Attributes
Attribute: x:Color
Type: String
Default: 0
<I> Tag
Used by: Excel only
Description
Specifies a change to italic within an Excel rich-text data stream.
<o:SmartTags> Tag
Description
A collection of SmartTag tags, each of which denote single instances of a smart tag on a cell.
The child tags of this collection have namespaces that have been defined at both the top of the document per XML
standards and with SmartTagType. stN (for example, st1, st2) is the common local alias for these namespaces. For
example, if a smart tag type is defined with a namespace of "urn:mycompany-com" and a name of "bar", expect child
tags called "<st1:bar>" where st1 refers to the urn:mycompany-com namespace.
To add smart tags to your workbook, go to the Smart Tags tab (AutoCorrect dialog box, Tools menu) and check all the
boxes. Smart tags are not available in the Spreadsheet component.
<o:SmartTagType> Tag
Description
Defines a smart tag type category that is used within this workbook. A smart tag type is fully defined by both a
namespace and a tag name; this is what smart tag actions register to provide actions for, and what smart tag recognizers
pass to the applications as annotations.
To add smart tags to your workbook, go to the Smart Tags tab (AutoCorrect dialog box, Tools menu) and check all of
the boxes. Smart tags are not available in the Spreadsheet component.
Required Attributes
Attribute: o:name
Description: The tag name that this smart tag type is using.
Type: String
Attribute: o:namespaceuri
Type: String
<S> Tag
Description
Specifies a change to strikethrough within an Excel rich-text data stream.
<Span> Tag
Description
This element is used to save outline formatting, for example:
<Span ss:Style="text-effect:outline">
.
<ss:Alignment> Tag
Description
Defines the font alignment attributes to use in this style. Each attribute that is specified is considered an override from the
default.
Optional Attributes
Attribute: ss:Horizontal
Default: Automatic
Attribute: ss:Indent
Default: 0
Attribute: ss:ReadingOrder
Default: Context
Attribute: ss:Rotate
Type: Double
Default: 0
Attribute: ss:ShrinkToFit
Description: True means that the text size should be shrunk so that all
of the text fits within the cell. False means that the font
within the cell should behave normally. The Spreadsheet
component does not support this attribute.
Type: Boolean
Default: 0 (False)
Attribute: ss:Vertical
Default: Automatic
Attribute: ss:VerticalText
Type: Boolean
Default: 0 (False)
Attribute: ss:WrapText
Description: Specifies whether the text in this cell should wrap at the
cell boundary. False means that text either spills or gets
truncated at the cell boundary (depending on whether the
adjacent cell(s) have content). The Spreadsheet
component does not support this attribute.
Type: Boolean
Default: 0 (False)
<ss:Border> Tag
Description
Defines a single border within this style's Borders collection. The Borders collection may contain up to six unique
Border elements. If duplicate Border elements exist, the behavior is unspecified and the XML Spreadsheet document is
considered invalid.
Required Attributes
Attribute: ss:Position
Optional Attributes
Attribute: ss:Color
Description: Specifies the color of this border. This value can be either
a 6-hexadecimal digit number in "#rrggbb" format or it
can be any of the Microsoft® Internet Explorer named
colors (including the named Microsoft Windows® colors).
This string can also be the special value of "Automatic."
This string is case insensitive.
Type: String
Default: Automatic
Attribute: ss:LineStyle
Default: None
Attribute: ss:Weight
1—Thin
2—Medium
3—Thick
Type: Double
Default: 0
<ss:Borders> Tag
Description
Defines the border properties for cells referencing this style. The Borders element contains no attributes; it is purely a
container for individual Border elements.
<ss:Cell> Tag
Description
Defines a single cell within the contained row.
Optional Attributes
Attribute: c:PasteFormula
Type: String
Attribute: ss:ArrayRange
Copy Code
<ss:Table>
<ss:Row ss:Height="3">
<ss:Cell ss:ArrayRange="R1C1:R2C2"
ss:Formula="={1,2;3,4}">
<ss:Data
ss:Type="Number">1</ss:Data>
</ss:Cell>
<ss:Cell>
<ss:Data
ss:Type="Number">2</ss:Data>
</ss:Cell>
</ss:Row>
...
</ss:Table>
Type: String
Attribute: ss:Formula
Description: Specifies the formula stored in this cell. All formulas are
persisted in R1C1 notation because they are significantly
easier to parse and generate than A1-style formulas. The
formula is calculated upon reload unless calculation is set
to manual. Recalculation of the formula overrides the
value in this cell's Value attribute.
Type: String
Attribute: ss:HRef
Description: Specifies the URL to which to link this cell. The cell's
<Value> <Data> element displays the content to show
on-screen.
Type: String
Attribute: ss:Index
Attribute: ss:MergeAcross
Default: 0
Attribute: ss:MergeDown
Default: 0
Attribute: ss:StyleID
Type: ID Reference
Attribute: x:HRefScreenTip
Type: String
<ss:Column> Tag
Description
Defines the formatting for one or more adjacent columns. This element contains no data; all cell data is stored within
Row elements. All ss:Column elements must appear before the first ss:Row element, otherwise unexpected behavior
may occur.
Optional Attributes
Attribute: c:Caption
Type: String
Attribute: ss:AutoFitWidth
Type: Boolean
Default: 1 (True)
Attribute: ss:Hidden
Type: Boolean
Attribute: ss:Index
Attribute: ss:Span
Attribute: ss:StyleID
Type: ID Reference
Attribute: ss:Width
Type: Double
<ss:Comment> Tag
Description
Contains the comment to be associated with this cell.
Optional Attributes
Attribute: ss:Author
Type: String
Attribute: ss:ShowAlways
Type: Boolean
Default: 0 (False)
<ss:Data> Tag
Description
Specifies the value of this cell. The value should be specified in the appropriate format based on the value of the cell's
Type attribute. This element can also be used to specify a cell's comment.
Examples
Copy Code
<ss:Cell ss:Formula="=foo">
<ss:Data ss:Type="Error">#NAME?</ss:Data>
</ss:Cell>
Represent a string:
Copy Code
<ss:Cell>
<ss:Data ss:Type="String">Bob's Market</ss:Data>
</ss:Cell>
Represent a number:
Copy Code
<ss:Cell>
<ss:Data ss:Type="Number">123</ss:Data>
</ss:Cell>
Represent rich-text:
Copy Code
<ss:Cell>
<ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
This is <B>Bold, <I>Bold Italic, </I></B><I>and Italic</I> text.</ss:Data>
</ss:Cell>
The Spreadsheet component will load rich-text and strip out the HTML elements. When saved, it will write a text-only
version.
When the data is Rich Text, we only support well-formed XML tags (even though it may look like HTML).
Required Attributes
Attribute: ss:Type
Optional Attributes
Attribute: x:Ticked
Type: Boolean
Default: 0 (False)
<ss:Font> Tag
Used by: Both Excel and the Spreadsheet component
Description
Defines the font attributes to use in this style. Each attribute that is specified is considered an override from the default.
Optional Attributes
Attribute: ss:Bold
Description: Specifies the bold state of the font. If the parent style has
Bold="1" and the child style wants to override the
setting, it must explicitly set the value to Bold="0". If this
attribute is not specified within an element, the default is
assumed.
Type: Boolean
Default: 0 (False)
Attribute: ss:Color
Description: Specifies the color of the font. This value can be either a
6-hexadecimal digit number in "#rrggbb" format or it can
be any of the Internet Explorer named colors (including
the named Windows colors). This string can also be
special value of Automatic. This string is case
insensitive. If this attribute is not specified within an
element, the default is assumed.
Type: String
Default: Automatic
Attribute: ss:FontName
Type: String
Default: Arial
Attribute: ss:Italic
Type: Boolean
Default: 0 (False)
Attribute: ss:Outline
Type: Boolean
Default: 0 (False)
Attribute: ss:Shadow
Type: Boolean
Default: 0 (False)
Attribute: ss:Size
Description: Specifies the size of the font in points. This value must be
strictly greater than 0. If this attribute is not specified
within an element, the default is assumed.
Type: Double
Default: 10
Attribute: ss:StrikeThrough
Type: Boolean
Default: 0 (False)
Attribute: ss:Underline
Default: None
Attribute: ss:VerticalAlign
Default: None
Attribute: x:CharSet
Default: 0
Attribute: x:Family
Default: Automatic
<ss:Interior> Tag
Description
Defines the fill properties to use in this style. Each attribute that is specified is considered an override from the default.
Optional Attributes
Attribute: ss:Color
Description: Specifies the fill color of the cell. This value can be either
a 6-hexadecimal digit number in "#rrggbb" format or it
can be any of the Internet Explorer named colors
(including the named Windows colors). This string can
also be special value of Automatic. This string is case
insensitive. If Pattern=Solid, this value is the fill color of
the cell. Otherwise, the cell is filled with a blend of Color
and PatternColor, with the Pattern attribute choosing
the appearance.
Type: String
Default: Automatic
Attribute: ss:Pattern
Description: Specifies the fill pattern in the cell. The fill pattern
determines how to blend the Color and PatternColor
attributes to produce the cell's appearance. The
Spreadsheet component does not support this attribute.
Default: None
Attribute: ss:PatternColor
Description: Specifies the secondary fill color of the cell when Pattern
does not equal Solid. The Spreadsheet component does
not support this attribute.
Type: String
Default: Automatic
<ss:NamedCell> Tag
Description
Presence of this tag indicates that this cell is a member of a user-defined named range. When saved from Excel, this tag
is only present on cells that are non-empty or contain formatting. This tag can appear multiple times (one for each user-
defined name that this cell lies in).
Required Attributes
Attribute: ss:Name
Type: String
<ss:NamedRange> Tag
Description
Defines a single named range within this workbook.
Required Attributes
Attribute: ss:Name
Description: Specifies the name of this named range. This name must
be unique within the list of named ranges and cannot
contain spaces or resemble an R1C1-style reference.
Type: String
Attribute: ss:RefersTo
Description: Specifies what this named range refers to. This should be
an Excel-style formula.
Examples:
ss:RefersTo="=123"
ss:RefersTo="=123*Rate"
ss:RefersTo="=R1C1*10"
Type: String
Optional Attributes
Attribute: ss:Hidden
Type: Boolean
Default: 0 (False)
<ss:Names> Tag
Description
Defines the collection of named ranges within this workbook or worksheet. ss:NamedRange elements in the
<ss:Workbook> collection require RefersTo attributes with an explicit SheetN! qualifier (for example, Sheet1!).
<ss:NumberFormat> Tag
Description
Defines the number format that should be in cells referencing this style. The default value is General, and all other
number formats require a custom format code.
Optional Attributes
Attribute: ss:Format
Type: String
Default: General
<ss:Protection> Tag
Description
Defines the protection properties that should be used in cells referencing this style. This element exists as a short-hand
way to apply protection to an entire table, row, or column, by simply adding it to a style.
The <ss:Protected> attribute of the <ss:Cell> element overrides a style's <ss:Protection> settings.
Optional Attributes
Attribute: ss:Protected
Type: Boolean
Default: 1 (True)
Attribute: x:HideFormula
Type: Boolean
Default: 0 (False)
<ss:Row> Tag
Used by: Both Excel and the Spreadsheet component
Description
Defines the formatting and data for one or more adjacent rows. If this element contains cell data, it must not contain the
Span attribute. Each Row element may contain one or more Cell elements defining the table's data.
Optional Attributes
Attribute: c:Caption
Type: String
Attribute: ss:AutoFitHeight
Description: If this attribute is True (1), it means that this row should
be autosized. By default all rows are autofitted, so
changing the size of the font in a cell will automatically
resize a row.
If both ss:Height and ss:AutoFitHeight exist, the
behavior is as follows:
Type: Boolean
Default: 1 (True)
Attribute: ss:Height
Type: Double
Attribute: ss:Hidden
Description: True specifies that this row is hidden. False (or omitted)
specifies that this row is shown.
Type: Boolean
Attribute: ss:Index
Description: Specifies the position of this row within the table. If this
tag is not specified, the first instance has an assumed
Index="1". Each additional Row element has an
assumed Index that is one higher.
Indices must appear in strictly increasing order. Failure
to do so will result in an XML Spreadsheet document
that is invalid. Indices do not need to be sequential,
however. Omitted indices are formatted with the default
style's format.
Attribute: ss:Span
Attribute: ss:StyleID
Type: ID Reference
<ss:Style> Tag
Description
Defines a single style in the current workbook. This element is optional, but is required to perform any custom formatting.
A style can be either standalone or based on one other style (this is called the parent style), in which case, all base
properties are first inherited from the parent, then the properties in the style are treated as overrides. Parent styles must
be specified before they are first referenced. This means we will not allow:
Copy Code
<ss:Styles>
<ss:Style ss:ID="xl1" ss:Parent="xl2"> ... </ss:Style>
<ss:Style ss:ID="xl2"> ... </ss:Style>
</ss:Styles>
To define the default style for this workbook, set the ss:ID attribute to "Default". If a Parent style is not specified, it is
assumed that the style with ID="Default" is used as the parent.
Required Attributes
Attribute: ss:ID
Optional Attributes
Attribute: ss:Name
Type: String
Attribute: ss:Parent
Type: ID Reference
<ss:Styles> Tag
Description
Contains the style definitions for the current worksheet. This element is optional, but is required to perform for any
custom formatting.
<ss:Table> Tag
Used by: Both Excel and the Spreadsheet component
Description
Defines the cell table within the current worksheet. In this version of the schema, only one instance of a Table tag is valid
for a single worksheet.
The optional TopCell, LeftCell, RowCount, and ColumnCount attributes specify the used range for this cell table,
indicating the furthest filled extents. Cell formulas are specified relative to the TopCell and LeftCell indices, and should
be adjusted when placed into a sheet (assuming that TopCell and LeftCell are not [1, 1]). When saving an entire
worksheet or a collection of sheets in a workbook, TopCell and LeftCell will be saved as (1, 1). When saving a range as
XML, the TopCell and LeftCell indices are used to specify the location of the range within the worksheet. This allows for
future expansion where multiple, non-overlapping tables could be stored within a single worksheet.
Optional Attributes
Attribute: ss:DefaultColumnWidth
Type: Double
Default: 48
Attribute: ss:DefaultRowHeight
Type: Double
Default: 12.75
Attribute: ss:ExpandedColumnCount
Attribute: ss:ExpandedRowCount
Attribute: ss:LeftCell
Default: 1
Attribute: ss:StyleID
Type: ID Reference
Attribute: ss:TopCell
Description: Specifies the row index that this table should be placed at.
This value must be greater than zero.
Default: 1
Attribute: x:FullColumns
Type: Boolean
Attribute: x:FullRows
Type: Boolean
<ss:Workbook> Tag
Description
Defines a workbook that will contain one or more Worksheet elements. This is the top-most element of an XML
Spreadsheet document and is required. This element has a required order for child elements. The order is:
Copy Code
<ss:Workbook>
<ss:Styles>
<ss:Names>
<ss:Worksheet>
...
<ss:Worksheet>
</ss:Workbook>
<ss:Worksheet> Tag
Description
Defines a worksheet within the current workbook. At least one instance of this element is required within a valid XML
Spreadsheet document. This element has a required order for child elements. The order is:
Copy Code
<ss:Worksheet>
<ss:Names>
<ss:Table>
<x:AutoFilter>
... Excel Stuff ...
</ss:Worksheet>
Required Attributes
Attribute: ss:Name
Description: This tag specifies the name of this worksheet. This value
must be unique within the list of sheet names in this
workbook. Sheet names must conform to the legal names
of Excel sheets and, thus, cannot contain /, \, ?, *, [, ].
Type: String
Optional Attributes
Attribute: ss:Protected
Type: Boolean
Default: 0 (False)
Attribute: ss:RightToLeft
Type: Boolean
Default: 0 (False)
<stN:SmartTag> Tag
Description
A collection of SmartTag tags, each of which denote single instances of a smart tag on a cell. stN (for example, st1, st2)
refers to the individual name space for this smart tag type as defined in the smart tag type definition. The name for this
tag is not SmartTag, either, but actually the tag name as defined in the SmartTagType tag.
To add smart tags to your workbook, go to the Smart Tags tab (AutoCorrect dialog box, Tools menu) and check all of
the boxes. Smart tags are not available in the Spreadsheet component.
stN:SmartTag tags can also contain an arbitrarily defined list of attributes with the tag. This is up to the smart tag owner
to define in the namespace. Programmatically, a developer can add new attributes to their smart tags either via
Range("A1").SmartTags(1).Properties.Add "star", "bar"
(which adds an attribute called Star with a value bar), or doing recognition or action time by manipulating the passed-in
ISmartTagProperties object.
<Sub> Tag
Description
Specifies a change to subscript within an Excel rich-text data stream.
<Sup> Tag
Description
Specifies a change to superscript within an Excel rich-text data stream.
<U> Tag
Description
Specifies a change to underline within an Excel rich-text data stream.
Optional Attributes
Attribute: x:Style
Default: text-underline:single
<x:AutoFilter> Tag
Description
Defines an AutoFilter range on the current worksheet. This element can contain one or more x:AutoFilterColumn
elements (up to one per column) with the appropriate filter settings. If no x:AutoFilterColumn elements exist, each
column in the range is assumed to be set to Type="all" (see x:AutoFilterColumn for more details).
Required Attributes
Attribute: x:Range
Type: String
<x:AutoFilterAnd> Tag
Description
Defines an AND condition in a custom AutoFilter function. Currently, Excel allows a custom AutoFilter function to contain
at most one AND or one OR condition. If this tag exists, it must contain at least one <x:AutoFilterCondition> tag to
define the test condition(s).
<x:AutoFilterColumn> Tag
Description
Defines the filtering properties for a single column of the AutoFilter range. If one or more columns are omitted, we
assume that no filtering should occur on those columns.
Optional Attributes
Attribute: x:Hidden
Type: Boolean
Default: 0 (False)
Attribute: x:Index
Description: Specifies the position of this column within the AutoFilter
range.
If this tag is not specified, the first instance has an
assumed Index="1". Each additional
<x:AutoFilterColumn> element has an assumed
Index that is one higher.
Attribute: x:Type
Default: All
Attribute: x:Value
Type: Double
Default: 0
<x:AutoFilterCondition> Tag
Description
Defines a single condition in a custom AutoFilter function.
Required Attributes
Attribute: x:Operator
Attribute: x:Value
Type: String
<x:AutoFilterOr> Tag
Description
Defines an OR condition in a custom AutoFilter function. Currently, Excel allows a custom AutoFilter function to contain at
most one AND or one OR condition. If this tag exists, it must contain two <x:AutoFilterCondition> tags, defining the
test conditions.
<x:Footer> Tag
Description
Specifies the footer for each printed page.
Required Attributes
Attribute: x:Margin
Type: Double
Default: 0.5
Optional Attributes
Attribute: x:Data
Description: Specifies the data for the footer. This is a string in the
same format as the Cascading Style Sheet (CSS) for Excel
2000.
Type: String
<x:Header> Tag
Required Attributes
Attribute: x:Margin
Type: Double
Default: 0.5
Optional Attributes
Attribute: x:Data
Description: Specifies the data for the header. This is a string in the
same format as the Cascading Style Sheet (CSS) for Excel
2000.
Type: String
<x:Layout> Tag
Description
Determines the layout for the page setup. This includes page orientation, centering, and page numbers.
Optional Attributes
Attribute: x:CenterHorizontal
Type: Boolean
Default: 0 (False)
Attribute: x:CenterVertical
Type: Boolean
Default: 0 (False)
Attribute: x:Orientation
Default: Portrait
Attribute: x:StartPageNumber
<x:PageMargins> Tag
Description
Specifies the margins for printed pages.
Required Attributes
Attribute: x:Bottom
Type: Double
Default: 1
Attribute: x:Left
Type: Double
Default: 0.75
Attribute: x:Right
Type: Double
Default: 0.75
Attribute: x:Top
Type: Double
Default: 1
<x:PageSetup> Tag
Description
Contains the print options for this workbook.
<x:PhoneticText> Tag
Description
Specifies the additional phonetic "hint" text that should be associated with this cell's data. This information is extremely
important for East Asia, especially for sorting data.
Optional Attributes
Attribute: x:Visible
Type: Boolean
Default: 0 (False)
<x:WorksheetOptions> Tag
Description
This is an Excel defined element that contains a number of specific Excel features.