xmlDrawing.go 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. package excelize
  2. // Source relationship and namespace.
  3. const (
  4. SourceRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
  5. SourceRelationshipImage = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
  6. SourceRelationshipDrawingML = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
  7. NameSpaceDrawingML = "http://schemas.openxmlformats.org/drawingml/2006/main"
  8. NameSpaceSpreadSheetDrawing = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
  9. )
  10. // xlsxCNvPr directly maps the cNvPr (Non-Visual Drawing Properties).
  11. // This element specifies non-visual canvas properties. This allows for
  12. // additional information that does not affect the appearance of the
  13. // picture to be stored.
  14. type xlsxCNvPr struct {
  15. ID int `xml:"id,attr"`
  16. Name string `xml:"name,attr"`
  17. Descr string `xml:"descr,attr"`
  18. Title string `xml:"title,attr,omitempty"`
  19. }
  20. // xlsxPicLocks directly maps the picLocks (Picture Locks). This element
  21. // specifies all locking properties for a graphic frame. These properties
  22. // inform the generating application about specific properties that have
  23. // been previously locked and thus should not be changed.
  24. type xlsxPicLocks struct {
  25. NoAdjustHandles bool `xml:"noAdjustHandles,attr,omitempty"`
  26. NoChangeArrowheads bool `xml:"noChangeArrowheads,attr,omitempty"`
  27. NoChangeAspect bool `xml:"noChangeAspect,attr"`
  28. NoChangeShapeType bool `xml:"noChangeShapeType,attr,omitempty"`
  29. NoCrop bool `xml:"noCrop,attr,omitempty"`
  30. NoEditPoints bool `xml:"noEditPoints,attr,omitempty"`
  31. NoGrp bool `xml:"noGrp,attr,omitempty"`
  32. NoMove bool `xml:"noMove,attr,omitempty"`
  33. NoResize bool `xml:"noResize,attr,omitempty"`
  34. NoRot bool `xml:"noRot,attr,omitempty"`
  35. NoSelect bool `xml:"noSelect,attr,omitempty"`
  36. }
  37. // xlsxBlip directly maps the blip element in the namespace
  38. // http://purl.oclc.or g/ooxml/officeDoc ument/relationships -
  39. // This element specifies the existence of an image (binary large image or
  40. // picture) and contains a reference to the image data.
  41. type xlsxBlip struct {
  42. Embed string `xml:"r:embed,attr"`
  43. Cstate string `xml:"cstate,attr,omitempty"`
  44. R string `xml:"xmlns:r,attr"`
  45. }
  46. // xlsxStretch directly maps the stretch element. This element specifies
  47. // that a BLIP should be stretched to fill the target rectangle. The other
  48. // option is a tile where a BLIP is tiled to fill the available area.
  49. type xlsxStretch struct {
  50. FillRect string `xml:"a:fillRect"`
  51. }
  52. // xlsxOff directly maps the colOff and rowOff element. This element is used
  53. // to specify the column offset within a cell.
  54. type xlsxOff struct {
  55. X int `xml:"x,attr"`
  56. Y int `xml:"y,attr"`
  57. }
  58. // xlsxExt directly maps the ext element.
  59. type xlsxExt struct {
  60. Cx int `xml:"cx,attr"`
  61. Cy int `xml:"cy,attr"`
  62. }
  63. // xlsxPrstGeom directly maps the prstGeom (Preset geometry). This element specifies
  64. // when a preset geometric shape should be used instead of a custom geometric shape.
  65. // The generating application should be able to render all preset geometries enumerated
  66. // in the ST_ShapeType list.
  67. type xlsxPrstGeom struct {
  68. Prst string `xml:"prst,attr"`
  69. }
  70. // xlsxXfrm directly maps the xfrm (2D Transform for Graphic Frame). This element
  71. // specifies the transform to be applied to the corresponding graphic frame. This
  72. // transformation is applied to the graphic frame just as it would be for a shape
  73. // or group shape.
  74. type xlsxXfrm struct {
  75. Off xlsxOff `xml:"a:off"`
  76. Ext xlsxExt `xml:"a:ext"`
  77. }
  78. // xlsxCNvPicPr directly maps the cNvPicPr (Non-Visual Picture Drawing Properties).
  79. // This element specifies the non-visual properties for the picture canvas. These
  80. // properties are to be used by the generating application to determine how certain
  81. // properties are to be changed for the picture object in question.
  82. type xlsxCNvPicPr struct {
  83. PicLocks xlsxPicLocks `xml:"a:picLocks"`
  84. }
  85. // directly maps the nvPicPr (Non-Visual Properties for a Picture). This element specifies
  86. // all non-visual properties for a picture. This element is a container for the non-visual
  87. // identification properties, shape properties and application properties that are to be
  88. // associated with a picture. This allows for additional information that does not affect
  89. // the appearance of the picture to be stored.
  90. type xlsxNvPicPr struct {
  91. CNvPr xlsxCNvPr `xml:"xdr:cNvPr"`
  92. CNvPicPr xlsxCNvPicPr `xml:"xdr:cNvPicPr"`
  93. }
  94. // xlsxBlipFill directly maps the blipFill (Picture Fill). This element specifies the kind
  95. // of picture fill that the picture object has. Because a picture has a picture fill already
  96. // by default, it is possible to have two fills specified for a picture object.
  97. type xlsxBlipFill struct {
  98. Blip xlsxBlip `xml:"a:blip"`
  99. Stretch xlsxStretch `xml:"a:stretch"`
  100. }
  101. // xlsxSpPr directly maps the spPr (Shape Properties). This element specifies the visual shape
  102. // properties that can be applied to a picture. These are the same properties that are allowed
  103. // to describe the visual properties of a shape but are used here to describe the visual
  104. // appearance of a picture within a document.
  105. type xlsxSpPr struct {
  106. Xfrm xlsxXfrm `xml:"a:xfrm"`
  107. PrstGeom xlsxPrstGeom `xml:"a:prstGeom"`
  108. }
  109. // xlsxPic elements encompass the definition of pictures within the DrawingML framework. While
  110. // pictures are in many ways very similar to shapes they have specific properties that are unique
  111. // in order to optimize for picture- specific scenarios.
  112. type xlsxPic struct {
  113. NvPicPr xlsxNvPicPr `xml:"xdr:nvPicPr"`
  114. BlipFill xlsxBlipFill `xml:"xdr:blipFill"`
  115. SpPr xlsxSpPr `xml:"xdr:spPr"`
  116. }
  117. // xlsxFrom specifies the starting anchor.
  118. type xlsxFrom struct {
  119. Col int `xml:"xdr:col"`
  120. ColOff int `xml:"xdr:colOff"`
  121. Row int `xml:"xdr:row"`
  122. RowOff int `xml:"xdr:rowOff"`
  123. }
  124. // xlsxTo directly specifies the ending anchor.
  125. type xlsxTo struct {
  126. Col int `xml:"xdr:col"`
  127. ColOff int `xml:"xdr:colOff"`
  128. Row int `xml:"xdr:row"`
  129. RowOff int `xml:"xdr:rowOff"`
  130. }
  131. // xlsxClientData directly maps the clientData element. An empty element which specifies (via
  132. // attributes) certain properties related to printing and selection of the drawing object. The
  133. // fLocksWithSheet attribute (either true or false) determines whether to disable selection when
  134. // the sheet is protected, and fPrintsWithSheet attribute (either true or false) determines whether
  135. // the object is printed when the sheet is printed.
  136. type xlsxClientData struct {
  137. FLocksWithSheet bool `xml:"fLocksWithSheet,attr"`
  138. FPrintsWithSheet bool `xml:"fPrintsWithSheet,attr"`
  139. }
  140. // xlsxTwoCellAnchor directly maps the twoCellAnchor (Two Cell Anchor Shape Size). This element
  141. // specifies a two cell anchor placeholder for a group, a shape, or a drawing element. It moves
  142. // with cells and its extents are in EMU units.
  143. type xlsxTwoCellAnchor struct {
  144. EditAs string `xml:"editAs,attr,omitempty"`
  145. From *xlsxFrom `xml:"xdr:from"`
  146. To *xlsxTo `xml:"xdr:to"`
  147. Pic *xlsxPic `xml:"xdr:pic,omitempty"`
  148. GraphicFrame string `xml:",innerxml"`
  149. ClientData *xlsxClientData `xml:"xdr:clientData"`
  150. }
  151. // xlsxWsDr directly maps the root element for a part of this content type shall wsDr.
  152. type xlsxWsDr struct {
  153. TwoCellAnchor []*xlsxTwoCellAnchor `xml:"xdr:twoCellAnchor"`
  154. Xdr string `xml:"xmlns:xdr,attr"`
  155. A string `xml:"xmlns:a,attr"`
  156. }
  157. // encodeWsDr directly maps the element xdr:wsDr.
  158. type encodeWsDr struct {
  159. WsDr xlsxWsDr `xml:"xdr:wsDr"`
  160. }