2023-01-02 11:47:31 +08:00
|
|
|
// Copyright 2016 - 2023 The excelize Authors. All rights reserved. Use of
|
2018-09-14 00:44:23 +08:00
|
|
|
// this source code is governed by a BSD-style license that can be found in
|
|
|
|
// the LICENSE file.
|
|
|
|
//
|
2022-02-17 00:09:11 +08:00
|
|
|
// Package excelize providing a set of functions that allow you to write to and
|
|
|
|
// read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
|
|
|
|
// writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
|
|
|
|
// Supports complex components by high compatibility, and provided streaming
|
|
|
|
// API for generating or reading data from a worksheet with huge amounts of
|
2023-01-02 11:47:31 +08:00
|
|
|
// data. This library needs Go version 1.16 or later.
|
2018-09-14 00:58:48 +08:00
|
|
|
|
2017-01-17 19:06:42 +08:00
|
|
|
package excelize
|
|
|
|
|
|
|
|
import "encoding/xml"
|
|
|
|
|
2019-06-12 08:10:33 +08:00
|
|
|
// decodeCellAnchor directly maps the oneCellAnchor (One Cell Anchor Shape
|
|
|
|
// Size) and twoCellAnchor (Two Cell Anchor Shape Size). This element
|
|
|
|
// specifies a two cell anchor placeholder for a group, a shape, or a drawing
|
|
|
|
// element. It moves with cells and its extents are in EMU units.
|
2017-03-01 11:00:42 +08:00
|
|
|
type decodeCellAnchor struct {
|
2019-06-12 08:10:33 +08:00
|
|
|
EditAs string `xml:"editAs,attr,omitempty"`
|
|
|
|
From *decodeFrom `xml:"from"`
|
|
|
|
To *decodeTo `xml:"to"`
|
|
|
|
Sp *decodeSp `xml:"sp"`
|
This ref #1585, support to read one cell anchor pictures and improve date and time number format
- Support apply date and time number format with 16 languages: Persian, Polish, Portuguese, Punjabi, Quechua, Romanian, Romansh, Sakha, Sami, Sanskrit, Scottish Gaelic, Serbian, Sesotho sa Leboa, Setswana, Sindhi, Sinhala and Slovak
- Update the unit test and dependencies modules
2023-08-09 00:11:06 +08:00
|
|
|
Pic *decodePic `xml:"pic"`
|
2019-06-12 08:10:33 +08:00
|
|
|
ClientData *decodeClientData `xml:"clientData"`
|
|
|
|
Content string `xml:",innerxml"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// xdrSp (Shape) directly maps the sp element. This element specifies the
|
|
|
|
// existence of a single shape. A shape can either be a preset or a custom
|
|
|
|
// geometry, defined using the SpreadsheetDrawingML framework. In addition to
|
|
|
|
// a geometry each shape can have both visual and non-visual properties
|
|
|
|
// attached. Text and corresponding styling information can also be attached
|
|
|
|
// to a shape. This shape is specified along with all other shapes within
|
|
|
|
// either the shape tree or group shape elements.
|
|
|
|
type decodeSp struct {
|
|
|
|
NvSpPr *decodeNvSpPr `xml:"nvSpPr"`
|
|
|
|
SpPr *decodeSpPr `xml:"spPr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeSp (Non-Visual Properties for a Shape) directly maps the nvSpPr
|
|
|
|
// element. This element specifies all non-visual properties for a shape. This
|
|
|
|
// element is a container for the non-visual identification properties, shape
|
|
|
|
// properties and application properties that are to be associated with a
|
|
|
|
// shape. This allows for additional information that does not affect the
|
|
|
|
// appearance of the shape to be stored.
|
|
|
|
type decodeNvSpPr struct {
|
|
|
|
CNvPr *decodeCNvPr `xml:"cNvPr"`
|
2023-09-16 12:21:11 +08:00
|
|
|
ExtLst *decodeAExt `xml:"extLst"`
|
2019-06-12 08:10:33 +08:00
|
|
|
CNvSpPr *decodeCNvSpPr `xml:"cNvSpPr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeCNvSpPr (Connection Non-Visual Shape Properties) directly maps the
|
|
|
|
// cNvSpPr element. This element specifies the set of non-visual properties
|
|
|
|
// for a connection shape. These properties specify all data about the
|
|
|
|
// connection shape which do not affect its display within a spreadsheet.
|
|
|
|
type decodeCNvSpPr struct {
|
|
|
|
TxBox bool `xml:"txBox,attr"`
|
2017-01-17 19:06:42 +08:00
|
|
|
}
|
|
|
|
|
2017-01-18 16:05:01 +08:00
|
|
|
// decodeWsDr directly maps the root element for a part of this content type
|
2019-06-12 08:10:33 +08:00
|
|
|
// shall wsDr. In order to solve the problem that the label structure is
|
|
|
|
// changed after serialization and deserialization, two different structures
|
|
|
|
// are defined. decodeWsDr just for deserialization.
|
2017-01-17 19:06:42 +08:00
|
|
|
type decodeWsDr struct {
|
2022-03-05 14:48:34 +08:00
|
|
|
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing wsDr,omitempty"`
|
|
|
|
A string `xml:"xmlns a,attr"`
|
|
|
|
Xdr string `xml:"xmlns xdr,attr"`
|
|
|
|
R string `xml:"xmlns r,attr"`
|
|
|
|
AlternateContent []*xlsxInnerXML `xml:"http://schemas.openxmlformats.org/markup-compatibility/2006 AlternateContent"`
|
|
|
|
OneCellAnchor []*decodeCellAnchor `xml:"oneCellAnchor,omitempty"`
|
|
|
|
TwoCellAnchor []*decodeCellAnchor `xml:"twoCellAnchor,omitempty"`
|
2017-01-17 19:06:42 +08:00
|
|
|
}
|
2017-03-28 21:18:06 +08:00
|
|
|
|
|
|
|
// decodeCNvPr directly maps the cNvPr (Non-Visual Drawing Properties). This
|
|
|
|
// element specifies non-visual canvas properties. This allows for additional
|
2019-06-12 08:10:33 +08:00
|
|
|
// information that does not affect the appearance of the picture to be
|
|
|
|
// stored.
|
2017-03-28 21:18:06 +08:00
|
|
|
type decodeCNvPr struct {
|
2023-09-16 12:21:11 +08:00
|
|
|
XMLName xml.Name `xml:"cNvPr"`
|
|
|
|
ID int `xml:"id,attr"`
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
Descr string `xml:"descr,attr"`
|
|
|
|
Title string `xml:"title,attr,omitempty"`
|
2017-03-28 21:18:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// decodePicLocks directly maps the picLocks (Picture Locks). This element
|
2019-06-12 08:10:33 +08:00
|
|
|
// specifies all locking properties for a graphic frame. These properties
|
|
|
|
// inform the generating application about specific properties that have been
|
2017-03-28 21:18:06 +08:00
|
|
|
// previously locked and thus should not be changed.
|
|
|
|
type decodePicLocks struct {
|
|
|
|
NoAdjustHandles bool `xml:"noAdjustHandles,attr,omitempty"`
|
|
|
|
NoChangeArrowheads bool `xml:"noChangeArrowheads,attr,omitempty"`
|
|
|
|
NoChangeAspect bool `xml:"noChangeAspect,attr"`
|
|
|
|
NoChangeShapeType bool `xml:"noChangeShapeType,attr,omitempty"`
|
|
|
|
NoCrop bool `xml:"noCrop,attr,omitempty"`
|
|
|
|
NoEditPoints bool `xml:"noEditPoints,attr,omitempty"`
|
|
|
|
NoGrp bool `xml:"noGrp,attr,omitempty"`
|
|
|
|
NoMove bool `xml:"noMove,attr,omitempty"`
|
|
|
|
NoResize bool `xml:"noResize,attr,omitempty"`
|
|
|
|
NoRot bool `xml:"noRot,attr,omitempty"`
|
|
|
|
NoSelect bool `xml:"noSelect,attr,omitempty"`
|
|
|
|
}
|
|
|
|
|
2022-01-09 00:20:42 +08:00
|
|
|
// decodeBlip element specifies the existence of an image (binary large image
|
|
|
|
// or picture) and contains a reference to the image data.
|
2017-03-28 21:18:06 +08:00
|
|
|
type decodeBlip struct {
|
|
|
|
Embed string `xml:"embed,attr"`
|
|
|
|
Cstate string `xml:"cstate,attr,omitempty"`
|
|
|
|
R string `xml:"r,attr"`
|
|
|
|
}
|
|
|
|
|
2019-06-12 08:10:33 +08:00
|
|
|
// decodeStretch directly maps the stretch element. This element specifies
|
|
|
|
// that a BLIP should be stretched to fill the target rectangle. The other
|
|
|
|
// option is a tile where a BLIP is tiled to fill the available area.
|
2017-03-28 21:18:06 +08:00
|
|
|
type decodeStretch struct {
|
|
|
|
FillRect string `xml:"fillRect"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeOff directly maps the colOff and rowOff element. This element is used
|
|
|
|
// to specify the column offset within a cell.
|
|
|
|
type decodeOff struct {
|
|
|
|
X int `xml:"x,attr"`
|
|
|
|
Y int `xml:"y,attr"`
|
|
|
|
}
|
|
|
|
|
2023-09-16 12:21:11 +08:00
|
|
|
// decodeAExt directly maps the a:ext element.
|
|
|
|
type decodeAExt struct {
|
2017-03-28 21:18:06 +08:00
|
|
|
Cx int `xml:"cx,attr"`
|
|
|
|
Cy int `xml:"cy,attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodePrstGeom directly maps the prstGeom (Preset geometry). This element
|
|
|
|
// specifies when a preset geometric shape should be used instead of a custom
|
|
|
|
// geometric shape. The generating application should be able to render all
|
|
|
|
// preset geometries enumerated in the ST_ShapeType list.
|
|
|
|
type decodePrstGeom struct {
|
|
|
|
Prst string `xml:"prst,attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeXfrm directly maps the xfrm (2D Transform for Graphic Frame). This
|
|
|
|
// element specifies the transform to be applied to the corresponding graphic
|
|
|
|
// frame. This transformation is applied to the graphic frame just as it would
|
|
|
|
// be for a shape or group shape.
|
|
|
|
type decodeXfrm struct {
|
2023-09-16 12:21:11 +08:00
|
|
|
Off decodeOff `xml:"off"`
|
|
|
|
Ext decodeAExt `xml:"ext"`
|
2017-03-28 21:18:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// decodeCNvPicPr directly maps the cNvPicPr (Non-Visual Picture Drawing
|
|
|
|
// Properties). This element specifies the non-visual properties for the picture
|
|
|
|
// canvas. These properties are to be used by the generating application to
|
|
|
|
// determine how certain properties are to be changed for the picture object in
|
|
|
|
// question.
|
|
|
|
type decodeCNvPicPr struct {
|
|
|
|
PicLocks decodePicLocks `xml:"picLocks"`
|
|
|
|
}
|
|
|
|
|
2019-06-12 08:10:33 +08:00
|
|
|
// directly maps the nvPicPr (Non-Visual Properties for a Picture). This
|
|
|
|
// element specifies all non-visual properties for a picture. This element is
|
|
|
|
// a container for the non-visual identification properties, shape properties
|
|
|
|
// and application properties that are to be associated with a picture. This
|
|
|
|
// allows for additional information that does not affect the appearance of
|
|
|
|
// the picture to be stored.
|
2017-03-28 21:18:06 +08:00
|
|
|
type decodeNvPicPr struct {
|
|
|
|
CNvPr decodeCNvPr `xml:"cNvPr"`
|
|
|
|
CNvPicPr decodeCNvPicPr `xml:"cNvPicPr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeBlipFill directly maps the blipFill (Picture Fill). This element
|
|
|
|
// specifies the kind of picture fill that the picture object has. Because a
|
|
|
|
// picture has a picture fill already by default, it is possible to have two
|
|
|
|
// fills specified for a picture object.
|
|
|
|
type decodeBlipFill struct {
|
|
|
|
Blip decodeBlip `xml:"blip"`
|
|
|
|
Stretch decodeStretch `xml:"stretch"`
|
|
|
|
}
|
|
|
|
|
2019-06-12 08:10:33 +08:00
|
|
|
// decodeSpPr directly maps the spPr (Shape Properties). This element
|
|
|
|
// specifies the visual shape properties that can be applied to a picture.
|
|
|
|
// These are the same properties that are allowed to describe the visual
|
|
|
|
// properties of a shape but are used here to describe the visual appearance
|
|
|
|
// of a picture within a document.
|
2017-03-28 21:18:06 +08:00
|
|
|
type decodeSpPr struct {
|
2019-06-12 08:10:33 +08:00
|
|
|
Xfrm decodeXfrm `xml:"xfrm"`
|
|
|
|
PrstGeom decodePrstGeom `xml:"prstGeom"`
|
2017-03-28 21:18:06 +08:00
|
|
|
}
|
|
|
|
|
2019-06-12 08:10:33 +08:00
|
|
|
// decodePic elements encompass the definition of pictures within the
|
|
|
|
// DrawingML framework. While pictures are in many ways very similar to shapes
|
|
|
|
// they have specific properties that are unique in order to optimize for
|
2023-05-30 00:14:44 +08:00
|
|
|
// picture-specific scenarios.
|
2017-03-28 21:18:06 +08:00
|
|
|
type decodePic struct {
|
|
|
|
NvPicPr decodeNvPicPr `xml:"nvPicPr"`
|
|
|
|
BlipFill decodeBlipFill `xml:"blipFill"`
|
|
|
|
SpPr decodeSpPr `xml:"spPr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeFrom specifies the starting anchor.
|
|
|
|
type decodeFrom struct {
|
|
|
|
Col int `xml:"col"`
|
|
|
|
ColOff int `xml:"colOff"`
|
|
|
|
Row int `xml:"row"`
|
|
|
|
RowOff int `xml:"rowOff"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// decodeTo directly specifies the ending anchor.
|
|
|
|
type decodeTo struct {
|
|
|
|
Col int `xml:"col"`
|
|
|
|
ColOff int `xml:"colOff"`
|
|
|
|
Row int `xml:"row"`
|
|
|
|
RowOff int `xml:"rowOff"`
|
|
|
|
}
|
|
|
|
|
2019-06-12 08:10:33 +08:00
|
|
|
// decodeClientData directly maps the clientData element. An empty element
|
|
|
|
// which specifies (via attributes) certain properties related to printing and
|
2017-03-28 21:18:06 +08:00
|
|
|
// selection of the drawing object. The fLocksWithSheet attribute (either true
|
|
|
|
// or false) determines whether to disable selection when the sheet is
|
|
|
|
// protected, and fPrintsWithSheet attribute (either true or false) determines
|
|
|
|
// whether the object is printed when the sheet is printed.
|
|
|
|
type decodeClientData struct {
|
|
|
|
FLocksWithSheet bool `xml:"fLocksWithSheet,attr"`
|
|
|
|
FPrintsWithSheet bool `xml:"fPrintsWithSheet,attr"`
|
|
|
|
}
|