Presentation is loading. Please wait.

Presentation is loading. Please wait.

SpreadsheetML Advanced

Similar presentations

Presentation on theme: "SpreadsheetML Advanced"— Presentation transcript:

1 SpreadsheetML Advanced

2 Disclaimer The information contained in this slide deck represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This slide deck is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this slide deck may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this slide deck. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this slide deck does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Unless otherwise noted, the example companies, organizations, products, domain names, addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, address, logo, person, place or event is intended or should be inferred. © 2006 Microsoft Corporation. All rights reserved. Microsoft, 2007 Microsoft Office System, .NET Framework 3.0, Visual Studio, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

3 Tables

4 SpreadsheetML Tables SpreadsheetML tables provide structure and formatting for worksheet information Design goals for SpreadsheetML tables: Separate presentation and data Data stays in the worksheet Table definition is in a separate part (referenced via a relationship) Cell definition lightweight but extensible Complex type with future storage capabilities Named ranges written in their own collection instead of on each cell Open XML has different types of tables for each document type, optimized for different scenarios: WordprocessingML has its tbl element SpreadsheetML has its table element PresentationML uses DrawingML tables (tbl inside graphicData)

5 SpreadsheetML Table: simple example
Worksheet (sheet1.xml) <sheetData> <row r="1" spans="1:2"> <c r="A1" t="s"><v>0</v></c> <c r="B1" t="s"><v>1</v></c> </row> <row r="2" spans="1:2"> <c r="A2"><v>1</v></c> <c r="B2"><v>4</v></c> <row r="3" spans="1:2"> <c r="A3"><v>2</v></c> <c r="B3"><v>5</v></c> <row r="4" spans="1:2"> <c r="A4"><v>3</v></c> <c r="B4"><v>6</v></c> </sheetData> ... <tableParts count="1"> <tablePart r:id="rId2"/> </tableParts> Headings = shared strings Data remains in sheetData Table definition (table1.xml) <table … ref="A1:B4” …> <autoFilter ref="A1:B4”/> <tableColumns count="2"> <tableColumn id="1" name="Column1" /> <tableColumn id="2" name="Column2" /> </tableColumns> <tableStyleInfo …/> </table> DEMO

6 Typical Tables Table #1 Table #2 Table #3 Header Row No Header Row
(merged cells) Totals Row No Totals Row Table #3 Header Row No Totals Row

7 Table #1

8 Table #2

9 Table #3

10 autoFilter definition
In worksheet part (sheet1.xml):

11 AutoFilter Result

12 conditionalFormatting

13 Cells with Conditional Formatting
> .5 Data Bars


15 Comment Example Typical comment Key concepts:
Comments are not stored in the worksheet Each worksheet may have a comment part Contains all comments for that worksheet Each comment is attached to a cell (A1 notation) Drawing/rendering information is stored separately VML-based legacy format Implicit worksheet relationships point to comment part and drawing part

16 Comment part (comment1.xml)
<comments xmlns="...spreadsheetml..."> <authors> <author>John Smith</author> </authors> <commentList> <comment ref="D4" authorId="0"> <text> <r> <rPr> <b /> <sz val="8" /> <color indexed="81" /> <rFont val="Tahoma" /> <family val="2" /> </rPr> <t>John:</t> </r> <t xml:space="preserve">Why is shipping so high on this item?</t> </text> </comment> </commentList> </comments> Author 0 (from the list) Comment for cell D4 Rich text formatting

17 Comments: vmlDrawing1.vml
Defines how to render the comment Uses VML (legacy schema being replaced by DrawingML) <xml xmlns:v="urn:schemas-microsoft-com:vml“ xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout> <v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"> <v:stroke joinstyle="miter"/> <v:path gradientshapeok="t" o:connecttype="rect"/> </v:shapetype> <v:shape id="_x0000_s1025" type="#_x0000_t202" style='position:absolute; margin-left:203.25pt;margin-top:37.5pt;width:96pt;height:55.5pt;z-index:1; visibility:hidden' fillcolor="#ffffe1" o:insetmode="auto"> <v:fill color2="#ffffe1"/> <v:shadow on="t" color="black" obscured="t"/> <v:path o:connecttype="none"/> <v:textbox style='mso-direction-alt:auto'> <div style='text-align:left'></div> </v:textbox> <x:ClientData ObjectType="Note"> <x:MoveWithCells/> <x:SizeWithCells/> <x:Anchor>4, 15, 2, 10, 6, 15, 6, 4</x:Anchor> <x:AutoFill>False</x:AutoFill> <x:Row>3</x:Row> <x:Column>3</x:Column> </x:ClientData> </v:shape> </xml>

18 Styles

19 Styles & Themes We have seen examples of direct formatting
Rich text settings in the <rPr> run properties element Applied directly to cell contents or comment text Formatting can also be specified by a style Named collection of formatting elements Style types: cell style, table style, pivotTable style A style may refer to a theme definition Themes define a set of colors, font information, and shape effects Direct formatting may also refer to a theme Picking a different theme changes the styles/formatting that refer to it

20 Style part (styles.xml)
Contents of the <styleSheet> element: Description Tag Number Format Expressions <numFmts> Font Definitions <fonts> Fill Definitions <fills> Border Definitions <borders> Master Records – Cell Styles <cellStyleXfs> Master Records – Formatting <cellXfs> Cell Styles <cellStyles> Differential Formatting Records <dxfs> Custom Table Styles <tableStyles>

21 Number Format Expressions <numFmts>
Cell number format definitions The numFmtId attribute uniquely identifies each entry Number formats don’t use 0-based index like other style definitions Example (for currency formatting): May not reference theme definitions # of formats defined Formatting expression <numFmts count="1"> <numFmt numFmtId="164" formatCode=""$"#,##0.00" /> </numFmts> ID for this formatting style (predefined in the spec)

22 Font Definitions <fonts>
Referenced by index (fontId) from master records Properties may reference theme definitions <fonts count="3"> <font>   <sz val="11" />   <color theme="1" />   <name val="Calibri" />   <family val="2" />   <scheme val="minor" />   </font>   <sz val="8" />   <color indexed="81" />   <name val="Tahoma" />   <b /> </fonts> fontId=0 Color 1 from theme definition Indexed color reference fontId=1 Bold version of above font fontId=2

23 Fill Definitions <fills>
Referenced by index (fillId) from master records ST_PatternType fill patterns documented in § <fills count="2"> <fill>   <patternFill patternType="none" />   </fill>   <patternFill patternType="gray125" /> <patternFill patternType=“solid”> <fgColor theme=“4”/> <bgColor theme=“4”/> </patternFill> </fills> Color 4 from theme definition

24 Border Definitions <borders>
Referenced by index (borderId) from master records Define presence/absence of borders, weight, color, etc. <borders count="1"> <border>   <left style=“medium”> <color indexed=“64”> </left>   <right style=“medium”> </right>   <top />   <bottom />   <diagonal />   </border> </borders> Left/right borders: medium, color 64 top, bottom, diagonal borders: none DEMO

25 Master Record – Cell Styles <cellStyleXfs>
Groups together a specific combination of style settings for use in a cellStyle definition Master records are referenced by index (xfId) <cellStyleXfs count="1"> <xf numFmtId="0" fontId="0" fillId="0" borderId="0" /> </cellStyleXfs> Border definition (0-based index) Fill definition (0-based index) Font definition (0-based index) Number format expression (unique ID)

26 Master Record – Formatting <cellXfs>
Groups together a specific combination of style settings for use in directing formatting from a cell NOTE: master records are referenced by index and not xfId (§ ). For example, to reference the 2nd master record above (i.e., index=1): <cellXfs count="2">   <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" />   <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1" /> </cellXfs> <c r=“A1” s=“1” t=“s”> <v>0</v> </c>

27 Master Record Direct Formatting

28 Cell Styles <cellStyles>
Collection of the cell styles used in the workbook <cellStyles count="1">   <cellStyle name="Normal" xfId="0" builtinId="0" />   <cellStyle name=“Accent1" xfId=“1" builtinId=“29" /> </cellStyles>

29 Differential Formatting Records <dxfs>
Groups of formatting information that can be applied as a differential/additive style Referenced by index (0-based) from a tableStyle element When applied, only the specified properties are changed and all other formatting properties retain their values <dxfs count=“1”> <dxf> <font> <b/> <color theme=“0”/> </font> <fill> <patternFill patternType=“solid”> <fgColor theme=“5”/> <bgColor theme=“5”/> </patternFill> </fill> </dxf> </dxfs> Change font to bold and change color, leave other font properties unchanged

30 Custom Table Styles <tableStyles>
Only custom-defined styles are saved – predefined Table/PivotTable styles are not saved Predefined Table/PivtoTable styles – see §3.8.40 13 table regions can be formatted 15 additional PivotTables regions All predefined styles reference themes Custom styles may reference themes <tableStyles count=“1" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleLight16" /> <tableStyle name=“TableStyleMedium10 – Custom” pivot=“0” count=“1”> <tableStyleElement type=“WholeTable” dxfId=“6”/> </tableStyle> </tableStyles> Apply the 7th differential formatting record to the “whole table” region

31 Custom Table Style Styles part: Table definition:

32 Style & Formatting Example
Left set of numbers have direct & themed formatting Table has a table style applied PivotTable has a table style applied

33 Vary The Theme Since all colors are specified as theme colors, they change when a different theme is selected Cells with non-theme colors specified wouldn’t change color with theme changes

34 Named Ranges

35 Named Ranges <defineNames>
This workbook-level element defines names for: Cells Named ranges Formulas Constants Names can’t be in the range A1 – XFD Names can’t begin with _xlnm Predefined names: _xlnm.Print_Area, _xlnm.Sheet_Title, etc. Best practice: use named ranges

36 Named Range Attributes
Name – required Description – user-viewable Comment – internal documentation Function/hidden/vbProcedure – booleans Scope defined by localSheetId Other attributes – see §3.2.5 <definedNames> <definedName name=“MyFormula” comment=“My comment.">SUM(Sheet3!$B$2:$B$9)</definedName> <definedName name=“MyRange1">Sheet3!$A$1:$C$12</definedName> <definedName name=“MyRange2" localSheetId="2” hidden="1">Sheet5!$A$1:$T$47</definedName> </definedNames> DEMO

37 Pivot Tables

38 PivotCacheDefinition
Pivot Tables Column axis Row axis Values Pivot tables simplify large data sets Aggregate information by rows/columns Two components must be defined: The pivot cache definition Defines the data source Workbook has a relation to the pivot cache definition The pivot table definition Defines the appearance Worksheet has a relationship to the pivot table definition Workbook 1 1 n n Sheet PivotCacheDefinition 1 1 n PivotTable n

39 Pivot Cache Definition
Defines data source (may be internal or external) Defines pivot-table fields and pivot values <pivotCacheDefinition refreshOnLoad="1" invalid="1"> <cacheSource type="worksheet"> <worksheetSource ref="A1:G1525" sheet="Sheet1" /> </cacheSource> <cacheFields count="2"> <cacheField name="Territory" numFmtId="0"> <sharedItems count="10"> <s v="Canada" /> <s v="Northwest" /> <s v="Southeast" /> ... <s v="Australia" /> </sharedItems> </cacheField> <cacheField name="Sale Total" numFmtId="0"> <sharedItems containsSemiMixedTypes="0“ containsString="0“ containsNumber="1" /> </cacheFields> </pivotCacheDefinition> Data source Cache field Pivot values

40 Pivot Table Definition
Defines the look & feel of the pivot table Associated cache definition (ID from workbook part) <pivotTableDefinition name="PivotTable1" cacheId="1“ dataCaption="Value"> <location ref="A1:B12" firstHeaderRow="1" firstDataRow="2" firstDataCol="1" /> <pivotFields count="2"> <pivotField axis="axisRow" showAll="0"> <items count="11"> <item x="0" /> <item x="1" /> ... <item t="default" /> </items> </pivotField> <pivotField dataField="1" showAll="0" /> </pivotFields> <rowFields count="1"> <field x="0" /> </rowFields> <dataFields count="1"> <dataField name="Sum of Sales" fld="1" /> </dataFields> </pivotTableDefinition> Location of the pivot table within the worksheet DEMO


Download ppt "SpreadsheetML Advanced"

Similar presentations

Ads by Google