DrawingML Overview
DrawingML is the language for defining graphical objects such as pictures, shapes, charts, and diagrams within ooxml documents. DrawingML是在ooxml文档中定义图形对象(如图片、形状、图表和图表)的语言。It also specifies package-wide appearance characteristics, i.e., the package's theme. 它还指定了包范围的外观特征,即包的主题。DrawingML is not a standalone markup language; it supports and appears within wordprocessingML, spreadsheetML, and presentationML documents. DrawingML不是一种独立的标记语言;它支持并出现在wordprocessingML、spreadsheetML和presentationML文档中。DrawingML is distinct from SVG and VML. DrawingML不同于SVG和VML。SVG (scaleable vector graphics) is a graphics file format for two-dimensional graphics in XML. SVG(可缩放矢量图形)是一种XML格式的二维图形文件格式。It is used mostly on the web and in desktop publishing. 它主要用于网络和桌面出版。VML is a competing language for vector graphic files. VML是矢量图形文件的竞争语言。It is now largely deprecated in favor of SVG. 现在,SVG在很大程度上被弃用。According to the ECMA OOXML specification, "The DrawingML format is a newer and richer format created with the goal of eventually replacing any uses of VML in the Office Open XML formats. 根据ECMA OOXML规范,“DrawingML格式是一种更新、更丰富的格式,旨在最终取代VML在Office开放XML格式中的任何用途。VML is a transitional format; it is included in Office Open XML for legacy reasons only." VML是一种过渡格式;它包含在Office Open XML中只是出于遗留原因。”VML is still used extensively within Microsoft Word for certain graphic comnponents, in particular for things as shapes and text boxes.VML仍然在MicrosoftWord中广泛用于某些图形组件,特别是形状和文本框。
DrawingML is a sprawling, confusing set of specifications for a number of different visual components within office documents. DrawingML是一套杂乱无章、令人困惑的规范,适用于office文档中的许多不同视觉组件。It is composed of a number of different namespaces, and care must be taken to be sure you have the correct namespace and namespace prefix for a given element within a particular document type. 它由许多不同的名称空间组成,必须注意确保在特定文档类型中为给定元素提供了正确的名称空间和名称空间前缀。One must also be mindful of the differences between specification of the object and placement of the object within the document. 还必须注意对象的说明和对象在文档中的位置之间的差异。Sometimes the definition (and namespace) of the object is the same throughout the three document types and only the specification of placement varies from document type to document type. 有时,在三种文档类型中,对象的定义(和名称空间)是相同的,只有不同文档类型的放置规范不同。In other cases, both the object and placement are unique to each document type. 在其他情况下,对象和位置对于每种文档类型都是唯一的。
Below is a brief summary of the various object types within the three document types and their corresponding namespaces. 下面是三种文档类型中的各种对象类型及其相应名称空间的简要总结。DrawingML objects such as charts and diagrams in any document type are all placed within a <a:graphic> element, which in turn contains a <a:graphicData> element. DrawingML对象(如任何文档类型中的图表)都放置在<a:graphic>元素中,该元素又包含一个<a:graphicData>元素。These elements are part of the main drawingML namespace: xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main". 这些元素是drawingML主命名空间的一部分:xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"。The <a:graphicData> element is essentially undefined, so applications can support or not support the particular object that is defined within it. 这个<a:graphicData>元素本质上是未定义的,因此应用程序可以支持或不支持在其中定义的特定对象。The element has a uri attribute which is used to specify the type of data and/or "server" that can process the contents of the element. 元素有一个uri属性,用于指定可以处理元素内容的数据类型和/或“服务器”。For example, the uri for a picture within Word is "http://schemas.openxmlformats.org/drawingml/2006/picture". 例如,Word中图片的uri为“http://schemas.openxmlformats.org/drawingml/2006/picture”。Microsoft Office supports a set of objects, including charts, diagrams, locked canvas, table, ole, etc. Other applications will have their own set of supported object types.Microsoft Office支持一组对象,包括图表、图表、锁定画布、表、ole等。其他应用程序将有自己的一组受支持的对象类型。
|
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" 中。
|
---|---|
|
|
|
|
xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" 。
|
|
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" |
|
|
A shape is placed within a worksheet by a <drawing> element, which merely references a separate drawing1.xml (or drawing2.xml, etc.) part. Placement or anchoring of the chart is specified with the desired anchor (e.g., <xdr:twoCellAnchor> element) within the drawing part using the xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/speadsheetDrawing" namespace. The drawing part in turn contains an <xdr:sp> element which defines the shape. Note that it is is not within a <a:graphicData> element. | |
A chart is placed within a worksheet by a <drawing> element, which merely references a separate drawing1.xml (or drawing2.xml, etc.) part. Placement or anchoring of the chart is specified with the desired anchor (e.g., <xdr:twoCellAnchor> element) within the drawing part using the xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/speadsheetDrawing" namespace.
The drawing part in turn contains the typical <a:graphicData> element noted above, which contains a <c:chart> element. That element references a separate part chart1.xml (or chart2.xml, etc) which defines the chart. The namespace (and uri attribute value of <a:graphicData>) for the chart specification is xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart". |
|
A diagram is placed within a worksheet by a <drawing> element, which merely references a separate drawing1.xml (or drawing2.xml, etc.) part. Placement or anchoring of the diagram is specified with the desired anchor (e.g., <xdr:twoCellAnchor> element) within the drawing part using the xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/speadsheetDrawing" namespace.
The drawing part in turn contains the typical <a:graphicData> element noted above, which contains a <dgm:relIds> element. That element references a group of four separate parts (one group for each diagram): colors#.xml, data#.xml, layout#.xml, and quickStyle#.xml which together define the diagram. The namespace (and uri attribute value of <a:graphicData>) for the diagram specification is xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram". |
|
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" |
|
|
A shape is defined with other content for the slide in slide1.xml (or slide2.xml, etc.) in a <p:sp> element. The namespace is xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main". Note that it is is not within a <a:graphicData> element. | |
A chart is placed within a slide by a <p:graphicFrame> element, which in turn contains the typical <a:graphicData> element noted above, which contains a <c:chart> element. That element references a separate part chart1.xml (or chart2.xml, etc) which defines the chart.
The namespace (and uri attribute value of <a:graphicData>) for the chart specification is xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart". |
|
A diagram is placed within a slide by a <p:graphicFrame> element, which in turn contains the typical <a:graphicData> element noted above, which contains a <dgm:relIds> element. That element references a group of four separate parts (one group for each diagram): colors#.xml, data#.xml, layout#.xml, and quickStyle#.xml which together define the diagram. There is also a fifth part, drawing#.xml, which Microsoft added as an extension for persisting diagram layout information.
The namespace (and uri attribute value of <a:graphicData>) for the diagram specification is xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram". |
|
OOXML has three different table models--one for wordprocessing tables, on for spreadsheet tables, and one for presentations. This last one is part of drawingML. A table is placed within a slide by a <p:graphicFrame> element, which in turn contains the typical <a:graphicData> element noted above, which contains an <a:tbl> element. That element contains the data for the table inline--the table is NOT in a separate part.
The uri attribute value of <a:graphicData> is "http://schemas.openxmlformats.org/drawingml/2006/table". |
|
Themes enable common styling across document types and are defined within the main drawingML namespace: xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main". |
The ECMA OOXML specification (3rd edition) for drawingML is broken up into different sections, mostly to reflect the different namespaces.用于drawingML的ECMA OOXML规范(第3版)分为不同的部分,主要是为了反映不同的名称空间。
There is a section (20.1) on most of the main features in the namespace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main", including shapes, non-visual properties, colors, and styles. A different section (201.1) covers the remaining parts of the main drawingML namespace, including text and text formatting, bullets and numbering, and tables, all used mostly within presentation documents. There is a separate section (20.2) on pictures generally; the namespace for a picture varies with the document type. Then there is a section (21.2) for the chart namespace (xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart") and a section (21.4) for the diagram namespace (mlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram"). There is a section (20.4) for placement/positioning of drawingML objects within wordprocessing documents (xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"), and a section (20.5) for placement/positioning of drawingML objects within spreadsheet documents (xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing). Finally, there are separate sections on locked canvases (20.3, not covered here) and on drawings within charts (21.3) 最后,在锁定的画布(20.3,此处未涉及)和图表中的图纸(21.3)上有单独的部分(xmlns:cdr="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing).