xmlDrawing.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. // Copyright 2016 - 2020 The excelize Authors. All rights reserved. Use of
  2. // this source code is governed by a BSD-style license that can be found in
  3. // the LICENSE file.
  4. //
  5. // Package excelize providing a set of functions that allow you to write to
  6. // and read from XLSX / XLSM / XLTM files. Supports reading and writing
  7. // spreadsheet documents generated by Microsoft Exce™ 2007 and later. Supports
  8. // complex components by high compatibility, and provided streaming API for
  9. // generating or reading data from a worksheet with huge amounts of data. This
  10. // library needs Go version 1.10 or later.
  11. package excelize
  12. import "encoding/xml"
  13. // Source relationship and namespace.
  14. const (
  15. SourceRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
  16. SourceRelationshipChart = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
  17. SourceRelationshipComments = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
  18. SourceRelationshipImage = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
  19. SourceRelationshipTable = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
  20. SourceRelationshipDrawingML = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
  21. SourceRelationshipDrawingVML = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
  22. SourceRelationshipHyperLink = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
  23. SourceRelationshipWorkSheet = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
  24. SourceRelationshipChartsheet = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet"
  25. SourceRelationshipDialogsheet = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet"
  26. SourceRelationshipPivotTable = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"
  27. SourceRelationshipPivotCache = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"
  28. SourceRelationshipSharedStrings = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"
  29. SourceRelationshipVBAProject = "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
  30. SourceRelationshipChart201506 = "http://schemas.microsoft.com/office/drawing/2015/06/chart"
  31. SourceRelationshipChart20070802 = "http://schemas.microsoft.com/office/drawing/2007/8/2/chart"
  32. SourceRelationshipChart2014 = "http://schemas.microsoft.com/office/drawing/2014/chart"
  33. SourceRelationshipCompatibility = "http://schemas.openxmlformats.org/markup-compatibility/2006"
  34. NameSpaceDrawingML = "http://schemas.openxmlformats.org/drawingml/2006/main"
  35. NameSpaceDrawingMLChart = "http://schemas.openxmlformats.org/drawingml/2006/chart"
  36. NameSpaceDrawingMLSpreadSheet = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
  37. NameSpaceSpreadSheet = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
  38. NameSpaceSpreadSheetX14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
  39. NameSpaceSpreadSheetX15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"
  40. NameSpaceSpreadSheetExcel2006Main = "http://schemas.microsoft.com/office/excel/2006/main"
  41. NameSpaceMacExcel2008Main = "http://schemas.microsoft.com/office/mac/excel/2008/main"
  42. NameSpaceXML = "http://www.w3.org/XML/1998/namespace"
  43. NameSpaceXMLSchemaInstance = "http://www.w3.org/2001/XMLSchema-instance"
  44. StrictSourceRelationship = "http://purl.oclc.org/ooxml/officeDocument/relationships"
  45. StrictSourceRelationshipChart = "http://purl.oclc.org/ooxml/officeDocument/relationships/chart"
  46. StrictSourceRelationshipComments = "http://purl.oclc.org/ooxml/officeDocument/relationships/comments"
  47. StrictSourceRelationshipImage = "http://purl.oclc.org/ooxml/officeDocument/relationships/image"
  48. StrictNameSpaceSpreadSheet = "http://purl.oclc.org/ooxml/spreadsheetml/main"
  49. NameSpaceDublinCore = "http://purl.org/dc/elements/1.1/"
  50. NameSpaceDublinCoreTerms = "http://purl.org/dc/terms/"
  51. NameSpaceDublinCoreMetadataIntiative = "http://purl.org/dc/dcmitype/"
  52. ContentTypeDrawing = "application/vnd.openxmlformats-officedocument.drawing+xml"
  53. ContentTypeDrawingML = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
  54. ContentTypeMacro = "application/vnd.ms-excel.sheet.macroEnabled.main+xml"
  55. ContentTypeSpreadSheetMLChartsheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml"
  56. ContentTypeSpreadSheetMLComments = "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"
  57. ContentTypeSpreadSheetMLPivotCacheDefinition = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml"
  58. ContentTypeSpreadSheetMLPivotTable = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"
  59. ContentTypeSpreadSheetMLSharedStrings = "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
  60. ContentTypeSpreadSheetMLTable = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
  61. ContentTypeSpreadSheetMLWorksheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
  62. ContentTypeVBA = "application/vnd.ms-office.vbaProject"
  63. ContentTypeVML = "application/vnd.openxmlformats-officedocument.vmlDrawing"
  64. // ExtURIConditionalFormattings is the extLst child element
  65. // ([ISO/IEC29500-1:2016] section 18.2.10) of the worksheet element
  66. // ([ISO/IEC29500-1:2016] section 18.3.1.99) is extended by the addition of
  67. // new child ext elements ([ISO/IEC29500-1:2016] section 18.2.7)
  68. ExtURIConditionalFormattings = "{78C0D931-6437-407D-A8EE-F0AAD7539E65}"
  69. ExtURIDataValidations = "{CCE6A557-97BC-4B89-ADB6-D9C93CAAB3DF}"
  70. ExtURISparklineGroups = "{05C60535-1F16-4fd2-B633-F4F36F0B64E0}"
  71. ExtURISlicerListX14 = "{A8765BA9-456A-4DAB-B4F3-ACF838C121DE}"
  72. ExtURISlicerCachesListX14 = "{BBE1A952-AA13-448e-AADC-164F8A28A991}"
  73. ExtURISlicerListX15 = "{3A4CF648-6AED-40f4-86FF-DC5316D8AED3}"
  74. ExtURIProtectedRanges = "{FC87AEE6-9EDD-4A0A-B7FB-166176984837}"
  75. ExtURIIgnoredErrors = "{01252117-D84E-4E92-8308-4BE1C098FCBB}"
  76. ExtURIWebExtensions = "{F7C9EE02-42E1-4005-9D12-6889AFFD525C}"
  77. ExtURITimelineRefs = "{7E03D99C-DC04-49d9-9315-930204A7B6E9}"
  78. ExtURIDrawingBlip = "{28A0092B-C50C-407E-A947-70E740481C1C}"
  79. ExtURIMacExcelMX = "{64002731-A6B0-56B0-2670-7721B7C09600}"
  80. )
  81. // Excel specifications and limits
  82. const (
  83. FileNameLength = 207
  84. TotalRows = 1048576
  85. TotalColumns = 16384
  86. TotalSheetHyperlinks = 65529
  87. TotalCellChars = 32767
  88. )
  89. var supportImageTypes = map[string]string{".gif": ".gif", ".jpg": ".jpeg", ".jpeg": ".jpeg", ".png": ".png", ".tif": ".tiff", ".tiff": ".tiff"}
  90. // xlsxCNvPr directly maps the cNvPr (Non-Visual Drawing Properties). This
  91. // element specifies non-visual canvas properties. This allows for additional
  92. // information that does not affect the appearance of the picture to be stored.
  93. type xlsxCNvPr struct {
  94. ID int `xml:"id,attr"`
  95. Name string `xml:"name,attr"`
  96. Descr string `xml:"descr,attr"`
  97. Title string `xml:"title,attr,omitempty"`
  98. HlinkClick *xlsxHlinkClick `xml:"a:hlinkClick"`
  99. }
  100. // xlsxHlinkClick (Click Hyperlink) Specifies the on-click hyperlink
  101. // information to be applied to a run of text. When the hyperlink text is
  102. // clicked the link is fetched.
  103. type xlsxHlinkClick struct {
  104. R string `xml:"xmlns:r,attr,omitempty"`
  105. RID string `xml:"r:id,attr,omitempty"`
  106. InvalidURL string `xml:"invalidUrl,attr,omitempty"`
  107. Action string `xml:"action,attr,omitempty"`
  108. TgtFrame string `xml:"tgtFrame,attr,omitempty"`
  109. Tooltip string `xml:"tooltip,attr,omitempty"`
  110. History bool `xml:"history,attr,omitempty"`
  111. HighlightClick bool `xml:"highlightClick,attr,omitempty"`
  112. EndSnd bool `xml:"endSnd,attr,omitempty"`
  113. }
  114. // xlsxPicLocks directly maps the picLocks (Picture Locks). This element
  115. // specifies all locking properties for a graphic frame. These properties inform
  116. // the generating application about specific properties that have been
  117. // previously locked and thus should not be changed.
  118. type xlsxPicLocks struct {
  119. NoAdjustHandles bool `xml:"noAdjustHandles,attr,omitempty"`
  120. NoChangeArrowheads bool `xml:"noChangeArrowheads,attr,omitempty"`
  121. NoChangeAspect bool `xml:"noChangeAspect,attr"`
  122. NoChangeShapeType bool `xml:"noChangeShapeType,attr,omitempty"`
  123. NoCrop bool `xml:"noCrop,attr,omitempty"`
  124. NoEditPoints bool `xml:"noEditPoints,attr,omitempty"`
  125. NoGrp bool `xml:"noGrp,attr,omitempty"`
  126. NoMove bool `xml:"noMove,attr,omitempty"`
  127. NoResize bool `xml:"noResize,attr,omitempty"`
  128. NoRot bool `xml:"noRot,attr,omitempty"`
  129. NoSelect bool `xml:"noSelect,attr,omitempty"`
  130. }
  131. // xlsxBlip directly maps the blip element in the namespace
  132. // http://purl.oclc.org/ooxml/officeDoc ument/relationships - This element
  133. // specifies the existence of an image (binary large image or picture) and
  134. // contains a reference to the image data.
  135. type xlsxBlip struct {
  136. Embed string `xml:"r:embed,attr"`
  137. Cstate string `xml:"cstate,attr,omitempty"`
  138. R string `xml:"xmlns:r,attr"`
  139. }
  140. // xlsxStretch directly maps the stretch element. This element specifies that a
  141. // BLIP should be stretched to fill the target rectangle. The other option is a
  142. // tile where a BLIP is tiled to fill the available area.
  143. type xlsxStretch struct {
  144. FillRect string `xml:"a:fillRect"`
  145. }
  146. // xlsxOff directly maps the colOff and rowOff element. This element is used to
  147. // specify the column offset within a cell.
  148. type xlsxOff struct {
  149. X int `xml:"x,attr"`
  150. Y int `xml:"y,attr"`
  151. }
  152. // xlsxExt directly maps the ext element.
  153. type xlsxExt struct {
  154. Cx int `xml:"cx,attr"`
  155. Cy int `xml:"cy,attr"`
  156. }
  157. // xlsxPrstGeom directly maps the prstGeom (Preset geometry). This element
  158. // specifies when a preset geometric shape should be used instead of a custom
  159. // geometric shape. The generating application should be able to render all
  160. // preset geometries enumerated in the ST_ShapeType list.
  161. type xlsxPrstGeom struct {
  162. Prst string `xml:"prst,attr"`
  163. }
  164. // xlsxXfrm directly maps the xfrm (2D Transform for Graphic Frame). This
  165. // element specifies the transform to be applied to the corresponding graphic
  166. // frame. This transformation is applied to the graphic frame just as it would
  167. // be for a shape or group shape.
  168. type xlsxXfrm struct {
  169. Off xlsxOff `xml:"a:off"`
  170. Ext xlsxExt `xml:"a:ext"`
  171. }
  172. // xlsxCNvPicPr directly maps the cNvPicPr (Non-Visual Picture Drawing
  173. // Properties). This element specifies the non-visual properties for the picture
  174. // canvas. These properties are to be used by the generating application to
  175. // determine how certain properties are to be changed for the picture object in
  176. // question.
  177. type xlsxCNvPicPr struct {
  178. PicLocks xlsxPicLocks `xml:"a:picLocks"`
  179. }
  180. // directly maps the nvPicPr (Non-Visual Properties for a Picture). This element
  181. // specifies all non-visual properties for a picture. This element is a
  182. // container for the non-visual identification properties, shape properties and
  183. // application properties that are to be associated with a picture. This allows
  184. // for additional information that does not affect the appearance of the picture
  185. // to be stored.
  186. type xlsxNvPicPr struct {
  187. CNvPr xlsxCNvPr `xml:"xdr:cNvPr"`
  188. CNvPicPr xlsxCNvPicPr `xml:"xdr:cNvPicPr"`
  189. }
  190. // xlsxBlipFill directly maps the blipFill (Picture Fill). This element
  191. // specifies the kind of picture fill that the picture object has. Because a
  192. // picture has a picture fill already by default, it is possible to have two
  193. // fills specified for a picture object.
  194. type xlsxBlipFill struct {
  195. Blip xlsxBlip `xml:"a:blip"`
  196. Stretch xlsxStretch `xml:"a:stretch"`
  197. }
  198. // xlsxSpPr directly maps the spPr (Shape Properties). This element specifies
  199. // the visual shape properties that can be applied to a picture. These are the
  200. // same properties that are allowed to describe the visual properties of a shape
  201. // but are used here to describe the visual appearance of a picture within a
  202. // document.
  203. type xlsxSpPr struct {
  204. Xfrm xlsxXfrm `xml:"a:xfrm"`
  205. PrstGeom xlsxPrstGeom `xml:"a:prstGeom"`
  206. }
  207. // xlsxPic elements encompass the definition of pictures within the DrawingML
  208. // framework. While pictures are in many ways very similar to shapes they have
  209. // specific properties that are unique in order to optimize for picture-
  210. // specific scenarios.
  211. type xlsxPic struct {
  212. NvPicPr xlsxNvPicPr `xml:"xdr:nvPicPr"`
  213. BlipFill xlsxBlipFill `xml:"xdr:blipFill"`
  214. SpPr xlsxSpPr `xml:"xdr:spPr"`
  215. }
  216. // xlsxFrom specifies the starting anchor.
  217. type xlsxFrom struct {
  218. Col int `xml:"xdr:col"`
  219. ColOff int `xml:"xdr:colOff"`
  220. Row int `xml:"xdr:row"`
  221. RowOff int `xml:"xdr:rowOff"`
  222. }
  223. // xlsxTo directly specifies the ending anchor.
  224. type xlsxTo struct {
  225. Col int `xml:"xdr:col"`
  226. ColOff int `xml:"xdr:colOff"`
  227. Row int `xml:"xdr:row"`
  228. RowOff int `xml:"xdr:rowOff"`
  229. }
  230. // xdrClientData directly maps the clientData element. An empty element which
  231. // specifies (via attributes) certain properties related to printing and
  232. // selection of the drawing object. The fLocksWithSheet attribute (either true
  233. // or false) determines whether to disable selection when the sheet is
  234. // protected, and fPrintsWithSheet attribute (either true or false) determines
  235. // whether the object is printed when the sheet is printed.
  236. type xdrClientData struct {
  237. FLocksWithSheet bool `xml:"fLocksWithSheet,attr"`
  238. FPrintsWithSheet bool `xml:"fPrintsWithSheet,attr"`
  239. }
  240. // xdrCellAnchor directly maps the oneCellAnchor (One Cell Anchor Shape Size)
  241. // and twoCellAnchor (Two Cell Anchor Shape Size). This element specifies a two
  242. // cell anchor placeholder for a group, a shape, or a drawing element. It moves
  243. // with cells and its extents are in EMU units.
  244. type xdrCellAnchor struct {
  245. EditAs string `xml:"editAs,attr,omitempty"`
  246. Pos *xlsxPoint2D `xml:"xdr:pos"`
  247. From *xlsxFrom `xml:"xdr:from"`
  248. To *xlsxTo `xml:"xdr:to"`
  249. Ext *xlsxExt `xml:"xdr:ext"`
  250. Sp *xdrSp `xml:"xdr:sp"`
  251. Pic *xlsxPic `xml:"xdr:pic,omitempty"`
  252. GraphicFrame string `xml:",innerxml"`
  253. ClientData *xdrClientData `xml:"xdr:clientData"`
  254. }
  255. // xlsxPoint2D describes the position of a drawing element within a spreadsheet.
  256. type xlsxPoint2D struct {
  257. XMLName xml.Name `xml:"xdr:pos"`
  258. X int `xml:"x,attr"`
  259. Y int `xml:"y,attr"`
  260. }
  261. // xlsxWsDr directly maps the root element for a part of this content type shall
  262. // wsDr.
  263. type xlsxWsDr struct {
  264. XMLName xml.Name `xml:"xdr:wsDr"`
  265. AbsoluteAnchor []*xdrCellAnchor `xml:"xdr:absoluteAnchor"`
  266. OneCellAnchor []*xdrCellAnchor `xml:"xdr:oneCellAnchor"`
  267. TwoCellAnchor []*xdrCellAnchor `xml:"xdr:twoCellAnchor"`
  268. A string `xml:"xmlns:a,attr,omitempty"`
  269. Xdr string `xml:"xmlns:xdr,attr,omitempty"`
  270. R string `xml:"xmlns:r,attr,omitempty"`
  271. }
  272. // xlsxGraphicFrame (Graphic Frame) directly maps the xdr:graphicFrame element.
  273. // This element specifies the existence of a graphics frame. This frame contains
  274. // a graphic that was generated by an external source and needs a container in
  275. // which to be displayed on the slide surface.
  276. type xlsxGraphicFrame struct {
  277. XMLName xml.Name `xml:"xdr:graphicFrame"`
  278. Macro string `xml:"macro,attr"`
  279. NvGraphicFramePr xlsxNvGraphicFramePr `xml:"xdr:nvGraphicFramePr"`
  280. Xfrm xlsxXfrm `xml:"xdr:xfrm"`
  281. Graphic *xlsxGraphic `xml:"a:graphic"`
  282. }
  283. // xlsxNvGraphicFramePr (Non-Visual Properties for a Graphic Frame) directly
  284. // maps the xdr:nvGraphicFramePr element. This element specifies all non-visual
  285. // properties for a graphic frame. This element is a container for the non-
  286. // visual identification properties, shape properties and application properties
  287. // that are to be associated with a graphic frame. This allows for additional
  288. // information that does not affect the appearance of the graphic frame to be
  289. // stored.
  290. type xlsxNvGraphicFramePr struct {
  291. CNvPr *xlsxCNvPr `xml:"xdr:cNvPr"`
  292. ChicNvGraphicFramePr string `xml:"xdr:cNvGraphicFramePr"`
  293. }
  294. // xlsxGraphic (Graphic Object) directly maps the a:graphic element. This
  295. // element specifies the existence of a single graphic object. Document authors
  296. // should refer to this element when they wish to persist a graphical object of
  297. // some kind. The specification for this graphical object is provided entirely
  298. // by the document author and referenced within the graphicData child element.
  299. type xlsxGraphic struct {
  300. GraphicData *xlsxGraphicData `xml:"a:graphicData"`
  301. }
  302. // xlsxGraphicData (Graphic Object Data) directly maps the a:graphicData
  303. // element. This element specifies the reference to a graphic object within the
  304. // document. This graphic object is provided entirely by the document authors
  305. // who choose to persist this data within the document.
  306. type xlsxGraphicData struct {
  307. URI string `xml:"uri,attr"`
  308. Chart *xlsxChart `xml:"c:chart,omitempty"`
  309. }
  310. // xlsxChart (Chart) directly maps the c:chart element.
  311. type xlsxChart struct {
  312. C string `xml:"xmlns:c,attr"`
  313. RID string `xml:"r:id,attr"`
  314. R string `xml:"xmlns:r,attr"`
  315. }
  316. // xdrSp (Shape) directly maps the xdr:sp element. This element specifies the
  317. // existence of a single shape. A shape can either be a preset or a custom
  318. // geometry, defined using the SpreadsheetDrawingML framework. In addition to a
  319. // geometry each shape can have both visual and non-visual properties attached.
  320. // Text and corresponding styling information can also be attached to a shape.
  321. // This shape is specified along with all other shapes within either the shape
  322. // tree or group shape elements.
  323. type xdrSp struct {
  324. Macro string `xml:"macro,attr"`
  325. Textlink string `xml:"textlink,attr"`
  326. NvSpPr *xdrNvSpPr `xml:"xdr:nvSpPr"`
  327. SpPr *xlsxSpPr `xml:"xdr:spPr"`
  328. Style *xdrStyle `xml:"xdr:style"`
  329. TxBody *xdrTxBody `xml:"xdr:txBody"`
  330. }
  331. // xdrNvSpPr (Non-Visual Properties for a Shape) directly maps the xdr:nvSpPr
  332. // element. This element specifies all non-visual properties for a shape. This
  333. // element is a container for the non-visual identification properties, shape
  334. // properties and application properties that are to be associated with a shape.
  335. // This allows for additional information that does not affect the appearance of
  336. // the shape to be stored.
  337. type xdrNvSpPr struct {
  338. CNvPr *xlsxCNvPr `xml:"xdr:cNvPr"`
  339. CNvSpPr *xdrCNvSpPr `xml:"xdr:cNvSpPr"`
  340. }
  341. // xdrCNvSpPr (Connection Non-Visual Shape Properties) directly maps the
  342. // xdr:cNvSpPr element. This element specifies the set of non-visual properties
  343. // for a connection shape. These properties specify all data about the
  344. // connection shape which do not affect its display within a spreadsheet.
  345. type xdrCNvSpPr struct {
  346. TxBox bool `xml:"txBox,attr"`
  347. }
  348. // xdrStyle (Shape Style) directly maps the xdr:style element. The element
  349. // specifies the style that is applied to a shape and the corresponding
  350. // references for each of the style components such as lines and fills.
  351. type xdrStyle struct {
  352. LnRef *aRef `xml:"a:lnRef"`
  353. FillRef *aRef `xml:"a:fillRef"`
  354. EffectRef *aRef `xml:"a:effectRef"`
  355. FontRef *aFontRef `xml:"a:fontRef"`
  356. }
  357. // aRef directly maps the a:lnRef, a:fillRef and a:effectRef element.
  358. type aRef struct {
  359. Idx int `xml:"idx,attr"`
  360. ScrgbClr *aScrgbClr `xml:"a:scrgbClr"`
  361. SchemeClr *attrValString `xml:"a:schemeClr"`
  362. SrgbClr *attrValString `xml:"a:srgbClr"`
  363. }
  364. // aScrgbClr (RGB Color Model - Percentage Variant) directly maps the a:scrgbClr
  365. // element. This element specifies a color using the red, green, blue RGB color
  366. // model. Each component, red, green, and blue is expressed as a percentage from
  367. // 0% to 100%. A linear gamma of 1.0 is assumed.
  368. type aScrgbClr struct {
  369. R float64 `xml:"r,attr"`
  370. G float64 `xml:"g,attr"`
  371. B float64 `xml:"b,attr"`
  372. }
  373. // aFontRef (Font Reference) directly maps the a:fontRef element. This element
  374. // represents a reference to a themed font. When used it specifies which themed
  375. // font to use along with a choice of color.
  376. type aFontRef struct {
  377. Idx string `xml:"idx,attr"`
  378. SchemeClr *attrValString `xml:"a:schemeClr"`
  379. }
  380. // xdrTxBody (Shape Text Body) directly maps the xdr:txBody element. This
  381. // element specifies the existence of text to be contained within the
  382. // corresponding shape. All visible text and visible text related properties are
  383. // contained within this element. There can be multiple paragraphs and within
  384. // paragraphs multiple runs of text.
  385. type xdrTxBody struct {
  386. BodyPr *aBodyPr `xml:"a:bodyPr"`
  387. P []*aP `xml:"a:p"`
  388. }
  389. // formatPicture directly maps the format settings of the picture.
  390. type formatPicture struct {
  391. FPrintsWithSheet bool `json:"print_obj"`
  392. FLocksWithSheet bool `json:"locked"`
  393. NoChangeAspect bool `json:"lock_aspect_ratio"`
  394. Autofit bool `json:"autofit"`
  395. OffsetX int `json:"x_offset"`
  396. OffsetY int `json:"y_offset"`
  397. XScale float64 `json:"x_scale"`
  398. YScale float64 `json:"y_scale"`
  399. Hyperlink string `json:"hyperlink"`
  400. HyperlinkType string `json:"hyperlink_type"`
  401. Positioning string `json:"positioning"`
  402. }
  403. // formatShape directly maps the format settings of the shape.
  404. type formatShape struct {
  405. Type string `json:"type"`
  406. Width int `json:"width"`
  407. Height int `json:"height"`
  408. Format formatPicture `json:"format"`
  409. Color formatShapeColor `json:"color"`
  410. Paragraph []formatShapeParagraph `json:"paragraph"`
  411. }
  412. // formatShapeParagraph directly maps the format settings of the paragraph in
  413. // the shape.
  414. type formatShapeParagraph struct {
  415. Font Font `json:"font"`
  416. Text string `json:"text"`
  417. }
  418. // formatShapeColor directly maps the color settings of the shape.
  419. type formatShapeColor struct {
  420. Line string `json:"line"`
  421. Fill string `json:"fill"`
  422. Effect string `json:"effect"`
  423. }