Presentation is loading. Please wait.

Presentation is loading. Please wait.

Open XML Developer Workshop SpreadsheetML Advanced.

Similar presentations


Presentation on theme: "Open XML Developer Workshop SpreadsheetML Advanced."— Presentation transcript:

1 Open XML Developer Workshop SpreadsheetML Advanced

2 Open XML Developer Workshop 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, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email 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 Open XML Developer Workshop Objectives This module covers SpreadsheetML concepts that are used in typical spreadsheet documents: Formatting options Anatomy of the styles part Styles and themes Named ranges Comments Pivot tables

4 Open XML Developer Workshop SpreadsheetML Formatting Options Direct Cell Formatting (XF) Fonts Fills Borders Numeric Formatting Cell Styles Table Styles PivotTable Styles

5 Open XML Developer Workshop STYLES

6 Open XML Developer Workshop Style part (styles.xml) Contents of the element: DescriptionTag Number Format Expressions Font Definitions Fill Definitions Border Definitions Master Records – Cell Styles Master Records – Formatting Cell Styles (named for UI) Differential Formatting Records Custom Table Styles

7 Open XML Developer Workshop Number Format Expressions 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 ID for this formatting style (to apply it directly)

8 Open XML Developer Workshop Font Definitions Referenced by index (fontId) from master records Properties may reference theme definitions Color 1 from theme definition Indexed color reference Bold version of above font fontId=0 fontId=1 fontId=2

9 Open XML Developer Workshop Fill Definitions Referenced by index (fillId) from master records ST_PatternType fill patterns documented in §3.18.57 Color 4 from theme definition

10 Open XML Developer Workshop Master Record – Cell Styles Groups together a specific combination of style settings for use in a cellStyle definition Master records are referenced by index (xfId) Border definition (0-based index) Fill definition (0-based index) Font definition (0-based index) Number format expression (unique ID)

11 Open XML Developer Workshop Master Record – Formatting 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 (§3.7.3.6). For example, to reference the 2 nd master record above (i.e., index=1): 0

12 Open XML Developer Workshop Master Record Direct Formatting DEMO

13 Open XML Developer Workshop DEMO

14 Open XML Developer Workshop Master Record Direct Formatting DEMO

15 Open XML Developer Workshop Styles & Themes We have seen examples of direct formatting Rich text settings in the 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

16 Open XML Developer Workshop DEMO

17 Open XML Developer Workshop Applying Cell, Table, PivotTable Styles Styles are named Explicit formatting records (xf) define the formatting properties

18 Open XML Developer Workshop Differential Formatting Records 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 Change font to bold and change color, leave other font properties unchanged

19 Open XML Developer Workshop Custom Table Styles 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 Apply the 7 th differential formatting record to the “whole table” region

20 Open XML Developer Workshop Custom Table Style Styles part: Table definition:

21 Open XML Developer Workshop Left set of numbers have direct & themed formatting Table has a table style applied PivotTable has a table style applied Style & Formatting Example

22 Open XML Developer Workshop 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 Vary The Theme

23 Open XML Developer Workshop conditionalFormatting Defined in worksheet part Applied to a range of cells DEMO

24 Open XML Developer Workshop DEMO

25 Open XML Developer Workshop NAMED RANGES

26 Open XML Developer Workshop Named Range (defined at workbook level) Name – required Description – user-viewable Comment – internal documentation Function/hidden/vbProcedure – booleans Scope defined by localSheetId Other attributes – see §3.2.5 DEMO SUM(Sheet3!$B$2:$B$9) Sheet3!$A$1:$C$12 Sheet5!$A$1:$T$47

27 Open XML Developer Workshop DEMO

28 Open XML Developer Workshop COMMENTS

29 Open XML Developer Workshop 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

30 Open XML Developer Workshop Comment part John Smith John: Why is shipping so high on this item? Comment for cell D4 Author 0 (from the list) Rich text formatting DEMO

31 Open XML Developer Workshop DEMO

32 Open XML Developer Workshop PIVOT TABLES

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

34 Open XML Developer Workshop Pivot Cache Definition Defines data source (may be internal or external) Defines pivot-table fields and pivot values...... Data source Cache field Pivot values

35 Open XML Developer Workshop Pivot Table Definition Defines the look & feel of the pivot table <pivotTableDefinition name="PivotTable1" cacheId="1“ dataCaption="Value"> <location ref="A1:B12" firstHeaderRow="1" firstDataRow="2" firstDataCol="1" />... <pivotTableDefinition name="PivotTable1" cacheId="1“ dataCaption="Value"> <location ref="A1:B12" firstHeaderRow="1" firstDataRow="2" firstDataCol="1" />... Associated cache definition (ID from workbook part) Location of the pivot table within the worksheet DEMO

36 Open XML Developer Workshop DEMO

37 Open XML Developer Workshop

38 LAB: SPREADSHEETML ADVANCED


Download ppt "Open XML Developer Workshop SpreadsheetML Advanced."

Similar presentations


Ads by Google