Presentation is loading. Please wait.

Presentation is loading. Please wait.

Open XML Developer Workshop DrawingML Basics. Open XML Developer Workshop Disclaimer The information contained in this slide deck represents the current.

Similar presentations


Presentation on theme: "Open XML Developer Workshop DrawingML Basics. Open XML Developer Workshop Disclaimer The information contained in this slide deck represents the current."— Presentation transcript:

1 Open XML Developer Workshop DrawingML Basics

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 Tip of a Large Iceberg

4 Open XML Developer Workshop SHAPES, PICTURES, GRAPHIC FRAMES, CHARTS

5 Open XML Developer Workshop DrawingML General Concepts 5 Main types of objects Shape Group Shape Connector Picture Graphic Frame General-purpose container Used for Charts, Diagrams, Tables Most widely used elements are Property elements Non-Visible Properties (nvPrs): union of common nvPrs and object specific nvPrs Visible Properties: object specific

6 Open XML Developer Workshop DrawingML Coordinate System Measured in EMU (English Metrical Unit) 914,400 EMU per inch 12,700 EMU in a point 360,000 EMU per cm

7 Open XML Developer Workshop SHAPES

8 Open XML Developer Workshop Shapes Preset geometry Pick the preset shape Specify the adjust values for the shape Text geometry Pick the preset text shape Specify the adjust values for the text shape Custom geometry Not covered in this course spTree nvGrpSpPrgrpSpPrsp nvSpPrspPr xfrmgeo fillPropertieslineProperties effectPropertiesscene3D sp3DbwMode styletxBody

9 Open XML Developer Workshop Shape Line and Fill Properties Indicates relationship id to image data BLIP (Binary Large Image or Pictures) Fill Gradient Fill Dash Line and Solid Fill Fill Dashed Line DEMO Line... Gradient stop and color

10 Open XML Developer Workshop DrawingML Text Text is largely modeled after Word’s design Similar structures Similar naming conventions Different schemas We can apply all graphic effects to text Some limited to runs Some limited to paragraph... <a:reflection blurRad="6350" stA="50000" endA="300" endPos="90000" dir="5400000“ sy="-100000" algn="bl" /> Reflective Text Text Effect

11 Open XML Developer Workshop 3-D 3-D Scene Definition Before Apply 3-D Scene Above Apply 3-D Bevels Adjust Material types DEMO

12 Open XML Developer Workshop DEMO

13 Open XML Developer Workshop PICTURES

14 Open XML Developer Workshop Pictures vs. Shapes 1.Single fill allowed 2.Borders grow in/outward 3.Must be done by app 4.Can have text attached 5.Can have shape properties 6.Shape specific UI enabled 1.Two overlaid fills allowed 2.Borders grow outward 3.Lock aspect ratio flag 4.Cannot have text attached 5.Can have shape properties 6.Picture specific UI enabled

15 Open XML Developer Workshop Defining a Picture Define a Picture: Source image rel. id Acts similar to a shape Non-Visual picture properties convey picture specific save properties Similar for Audio & Video

16 Open XML Developer Workshop Picture Properties 1.Multiple Fills Allows for two fills to be applied such as a picture and a color fill 2.Picture Borders Because of the nature of pictures the borders grow outwards rather than in/outwards 3.Lock Aspect Ratio Resizing a picture can be done with or without the aspect ratio locked

17 Open XML Developer Workshop GRAPHIC OBJECTS AND CHARTS

18 Open XML Developer Workshop Graphic Objects Graphic element represents a single graphical object GraphicData element and Uri attribute Specifies the namespace for the embedded content Tells the consumer how to interpret the graphicData Ability to render is application specific Office supports a set of specific URI values: http://schemas.openxmlformats.org/drawingml/2006/chart http://schemas.openxmlformats.org/drawingml/2006/diagrams … Graphic Object <c:chart xmlns:c="http://schemas.../drawingml/2006/chart" xmlns:r="http://schemas.../officeDocument/2006/relationships" r:id="rd123232" /> DEMO URI means chart follows

19 Open XML Developer Workshop Charts Overview Visualization of information Can be reused across applications / formats Rich chart types 11 types 2-dimensional and 3-dimensional DEMO ChartSwapping DEMO ChartSwapping

20 Open XML Developer Workshop DEMO

21 Open XML Developer Workshop Elements of a Chart Graphic Object definition References separate XML chart part Defined in DrawingML namespace Chart XML Part Visual representation of data. Includes a cache of data for chart. Includes formatting using DrawingML. Data Relationship External relationship to file, or Internal relationship to embedded spreadsheet Spreadsheets point to their own data. Chart Drawing Contains shapes and pictures drawn on chart XML Chart Part Graphic Object Data Source 1 n n 1 rId Chart Drawing 0,1 1 rId

22 Open XML Developer Workshop Main Elements of the Chart Part XML Namespace "http://schemas.openxmlformats.org/drawingml/2006/chart" ElementDescription Root node includes chart. Root element for the chart. If the chart is 3D, specifies the 3D view. Defines a layout and contains an element that defines the type of chart. The type of chart (Bar, Pie, etc.) Defines a series of data in the chart Category (axis) cache data (strings) Values cache data (numbers). Specifies the legend. Bar Chart specific values

23 Open XML Developer Workshop Chart Data Cache Structure PearsApplesLemons East4.32.42 West2.54.42 North3.51.83 South4.52.85 Series Values Categories Chart XML fragment Your code writes this XML to set chart data!

24 Open XML Developer Workshop Specifying Series Data Points Strings or numbers Literals or references Point values East West North South Sheet1!$A$2:$A$5 East West North South Sheet1!$B$2:$B$5 4.3 2.5 3.5 4.5 String Literal String ReferenceNumber Reference

25 Open XML Developer Workshop INSERTING DRAWING OBJECTS INTO DOCUMENTS

26 Open XML Developer Workshop Inserting DrawingML Objects Overview Drawing Types Allowed Charts Diagrams Locked Canvases Viewed but not edited by host Pictures The core DrawingML is the same in all hosts Location varies by host Wordprocessing: main body Spreadsheet: drawing part Presentation: slide Packaging (“shim”) varies DEMO

27 Open XML Developer Workshop Drawings in WordprocessingML http://schemas.../drawingml/2006/main... Shim defines anchor and flow Graphic object

28 Open XML Developer Workshop <xdr:wsDr xmlns:xdr="http://schemas.../drawingml/2006/spreadsheetDrawing" xmlns:a="http://schemas.../drawingml/2006/main">......... Drawings in SpreadsheetML Shim defines anchor and non-visual properties Graphic object

29 Open XML Developer Workshop............ Drawings in PresentationML No shim. The shape is in the tree Graphic object

30 Open XML Developer Workshop Inserting Drawings in WordprocessingML Documents

31 Open XML Developer Workshop... <a:graphicData... Object Positioning (Anchoring) Two ways to anchor in WordprocessingML: In line with text ( ) - The object is displayed within the regular text stream (modifying line height, etc. to accommodate it) Floating ( ) – The object is absolutely positioned within the document and text flow is modified as needed around it The type of anchoring is specified by the main element

32 Open XML Developer Workshop WordprocessingML Inline Objects The most basic type of DrawingML object placement is in line with text The object is displayed like a large character glyph

33 Open XML Developer Workshop WordprocessingML Floating Objects Floating objects are positioned on the page independent of text They can be positioned: Absolutely (e.g. 1” inside the top margin) Relatively (e.g. centered within the page margins) 9525 635 9525 EMUs inside the column 635 EMUs below the paragraph

34 Open XML Developer Workshop ElementExampleDescription wrapNone The object is positioned on the document and text is not displaced around it wrapSquare The object is positioned on the document and an implied rectangle determines the wrapping extents wrapTight A wrapping polygon, defined and stored in the file, determines the text wrapping extents wrapThrough Similar to tight wrapping – but any indents in the wrap polygon can be filled with text wrapTopAndBot tom Text cannot wrap around either side of the object Floating Object Text Wrapping in WordML Five ways to specify how text flows around the object DEMO WP Anchoring DEMO WP Anchoring

35 Open XML Developer Workshop DEMO

36 Open XML Developer Workshop Shapes created in WordprocessingML use VML <w:document xmlns:w=http://schemas.openxmlformats.org/wordprocessingml/2006/mainhttp://schemas.openxmlformats.org/wordprocessingml/2006/main xmlns:v="urn:schemas-microsoft-com:vml"...> <v:path gradientshapeok="t" o:connecttype="custom" o:connectlocs="10800,0;0,8259;4200,21600; 17400,21600;21600,8259" textboxrect="6720,8259,14880,15628"/> <v:shape id="_x0000_s1026" type="#_x0000_t12“ style="width:47.25pt; height:44.9pt;mso-position-horizontal-relative:char;mso- position-vertical-relative:line" fillcolor="#c6d9f1 [671]“ strokecolor="#4f81bd [3204]"> VML Namespace VML Elements

37 Open XML Developer Workshop DEMO

38 Open XML Developer Workshop Inserting DrawingML into Spreadsheet Documents

39 Open XML Developer Workshop Graphical Objects in SpreadsheetML Worksheet Drawings stored in Drawing Part Linked by Relationship ID. Root element: Anchoring properties (3 types) Absolute: One cell: Two cell: Drawing elements DEMO ShapesCharts Drawing Part Sheet 1 1 rId

40 Open XML Developer Workshop Absolute Anchoring Don’t move or size with cells Position explicitly specified Measured in EMUs Extents explicitly specified Measured in EMUs

41 Open XML Developer Workshop One Cell Anchoring Move with cells Position locked to single cell Position explicitly specified Measured in EMUs Extents explicitly specified Measured in EMUs 3 447675 8 28575...

42 Open XML Developer Workshop DEMO

43 Open XML Developer Workshop


Download ppt "Open XML Developer Workshop DrawingML Basics. Open XML Developer Workshop Disclaimer The information contained in this slide deck represents the current."

Similar presentations


Ads by Google