Article by Chhavi Kumar Agrawal, Sonata Software Limited
This article explains about line shape and how line properties like color, width, and head/tail etc details of line shape are represented in DrawingML language within drawing part stored in SpreadsheetML document.
The line shape inserted on the spreadsheet document will be represented as
<a:prstGeom prst="line">
<a:avLst/>
</a:prstGeom>
The main element which holds all the line properties is <a:ln> element. The sample xml snippet is represented below.
<a:ln w="25400" cap="rnd" cmpd="dbl">
<a:solidFill>
<a:srgbClr val="FF0000"/>
</a:solidFill>
<a:prstDash val="sysDash"/>
<a:bevel/>
<a:headEnd type="triangle" w="med" len="sm"/>
<a:tailEnd type="diamond" w="lg" len="med"/>
</a:ln>
Line width:- attribute w of <a:ln> is used to specify the width of line in EMU.
1 pt = 12700 EMUs.
<a:ln w="25400"/>
Attribute cap:- cap specifies whether the line ends are round (value rnd), square (sq), or flat (flat).
The possible values for this attribute are
1. rnd
2. sq
3. flat
<a:ln cap="rnd"/>
Compound line type:- Cmpd attribute of <a:ln> is used to specify compound line type its permitted values are
1. sng
2. dbl
3. thickThin
4. ThinThick
5. tri
Ex. <a:ln cmpd="dbl"/>
Line color:- line with solid fill element <a:srgbClr> is used to specify fill color
<a:solidFill>
<a:srgbClr val="FF0000"/>
</a:solidFill>
Line dash property:- element <a:prstDash> child of <a:ln> used to specify dash property of line. The possible values are
1. sysDot System dot style (PS_DOT). [- - - - - - - - - - - ]
2. sysDash System short dash style (PS_DASH). [--- --- --- --- --- ]
3. dash Short dash style. [---- ---- ---- ---- ---- ---- ]
4. lgDash Long dash style. [-------- -------- -------- -------- ]
5. lgDashDot Long dash followed by dot. [-------- - -------- - ]
6. lgDashDotDot Long dash followed by two dots.[-------- - - ------ - - ]
Ex. <a:prstDash val="sysDot"/>
Join type:- This simple type specifies the join styles for a line. Possible values are:-
1. Bevel
2. Miter
3. round
Ex. <a:bevel/>
Head/tail properties: - Head/Tail End properties specify whether there are any special attachments to the head or the tail of a line
1. For line having a arrow in tail end <a:tailEnd type="arrow"/>
2. For line having a arrow in head end <a:headEnd type="arrow"/>
3. For line having a arrow in both head and tail end
<a:headEnd type="arrow"/>
<a:tailEnd type="arrow"/>
Possible values of type atributes are:-
1. arrow
2. triangle
3. stealth
4. diamond
5. oval
6. none
The <a:headEnd> and <a:tailEnd> elements are having attributes “w” which specifies the width of arrowhead and “len” which specifies the length of arrowhead.
The possible values for both w and len are
1. sm (small)
2. med (medium)
3. lg (large)
Preset Shape:- Within the Shape Definitions and Attributes section of DrawingML there are many pre-defined shapes , line is one of them. Prst attribute of element a:prstGeom
Specifies the name of preset shape.
Ex:- <a:prstGeom prst="line">
You can refer section [5.9.3] in ECMA specification document for more information
In addition to the specifying of a preset shape there is also the possibility of a specifying a custom shape.
3-D Rotation in lines:-
<a:scene3d>
<a:camera prst="isometricOffAxis1Right">
<a:rot lat="1080000" lon="20039998" rev="600000"/>
</a:camera>
</a:scene3d>
The <a:camera> element defines the placement and properties of the camera in the 3D scene. The camera position and properties modify the view of the scene.
<a:camera> has two attributes prst which defines the preset camera that is being used by the camera element. The preset camera defines a starting point for common preset rotations in space.
and fov Provides an override for the default field of view for the camera. Different perspectives can be obtained by modifying this attribute.
Possible value of prst are:-
1. isometricLeftDown (Isometric Left Down)
2. isometricRightUp (Isometric Right Up)
3. isometricTopUp (Isometric Top Up)
4. etc.
Note: for all possible value of this type you can refer section [ 5.1.12.47] in ECMA specification document.
The range for fov attribute is 0° to 120° which is stored in xml multiple of 60000pt and the value should be positive number.
Example: 1° = 60000pt
The <a:rot> is used to specify a rotation in 3D space. A rotation in DrawingML is defined through the use of a latitude coordinate, a longitude coordinate, and a revolution about the axis as the latitude and longitude coordinates.
Attributes of element <a:rot> are lat, lon, rev
1. lat (Latitude)--defines the latitude value of the rotation.
2. Lon (Longitude)--defines the longitude value of the rotation.
3. Rev (Revolution)--defines the revolution around the central axis in the rotation.
The values for lat, lon, rev should be positive always. The possible value can be anything between 0° to 359.9° which is stored in xml multiple of 60000pt same as fov attribute.