2022-01-09 00:20:42 +08:00
|
|
|
// Copyright 2016 - 2022 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
|
|
|
|
// data. This library needs Go version 1.15 or later.
|
2018-09-14 00:58:48 +08:00
|
|
|
|
2017-04-23 00:10:23 +08:00
|
|
|
package excelize
|
|
|
|
|
2017-04-30 20:03:43 +08:00
|
|
|
import "encoding/xml"
|
2017-04-23 00:10:23 +08:00
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// xlsxChartSpace directly maps the chartSpace element. The chart namespace in
|
2017-04-23 00:10:23 +08:00
|
|
|
// DrawingML is for representing visualizations of numeric data with column
|
|
|
|
// charts, pie charts, scatter charts, or other types of charts.
|
2017-04-30 20:03:43 +08:00
|
|
|
type xlsxChartSpace struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/drawingml/2006/chart chartSpace"`
|
2017-04-23 00:10:23 +08:00
|
|
|
XMLNSa string `xml:"xmlns:a,attr"`
|
2019-06-05 22:06:15 +08:00
|
|
|
Date1904 *attrValBool `xml:"date1904"`
|
|
|
|
Lang *attrValString `xml:"lang"`
|
|
|
|
RoundedCorners *attrValBool `xml:"roundedCorners"`
|
|
|
|
Chart cChart `xml:"chart"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
|
|
|
TxPr *cTxPr `xml:"txPr"`
|
|
|
|
PrintSettings *cPrintSettings `xml:"printSettings"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// cThicknessSpPr directly maps the element that specifies the thickness of
|
|
|
|
// the walls or floor as a percentage of the largest dimension of the plot
|
|
|
|
// volume and SpPr element.
|
2017-04-23 00:10:23 +08:00
|
|
|
type cThicknessSpPr struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
Thickness *attrValInt `xml:"thickness"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cChart (Chart) directly maps the chart element. This element specifies a
|
2017-04-23 00:10:23 +08:00
|
|
|
// title.
|
|
|
|
type cChart struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
Title *cTitle `xml:"title"`
|
|
|
|
AutoTitleDeleted *cAutoTitleDeleted `xml:"autoTitleDeleted"`
|
|
|
|
View3D *cView3D `xml:"view3D"`
|
|
|
|
Floor *cThicknessSpPr `xml:"floor"`
|
|
|
|
SideWall *cThicknessSpPr `xml:"sideWall"`
|
|
|
|
BackWall *cThicknessSpPr `xml:"backWall"`
|
|
|
|
PlotArea *cPlotArea `xml:"plotArea"`
|
|
|
|
Legend *cLegend `xml:"legend"`
|
|
|
|
PlotVisOnly *attrValBool `xml:"plotVisOnly"`
|
|
|
|
DispBlanksAs *attrValString `xml:"dispBlanksAs"`
|
|
|
|
ShowDLblsOverMax *attrValBool `xml:"showDLblsOverMax"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// cTitle (Title) directly maps the title element. This element specifies a
|
2017-04-23 00:10:23 +08:00
|
|
|
// title.
|
|
|
|
type cTitle struct {
|
2019-12-28 15:05:44 +08:00
|
|
|
Tx cTx `xml:"tx,omitempty"`
|
|
|
|
Layout string `xml:"layout,omitempty"`
|
|
|
|
Overlay *attrValBool `xml:"overlay"`
|
|
|
|
SpPr cSpPr `xml:"spPr,omitempty"`
|
|
|
|
TxPr cTxPr `xml:"txPr,omitempty"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cTx (Chart Text) directly maps the tx element. This element specifies text
|
2017-04-23 00:10:23 +08:00
|
|
|
// to use on a chart, including rich text formatting.
|
|
|
|
type cTx struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
StrRef *cStrRef `xml:"strRef"`
|
|
|
|
Rich *cRich `xml:"rich,omitempty"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cRich (Rich Text) directly maps the rich element. This element contains a
|
2017-04-23 00:10:23 +08:00
|
|
|
// string with rich text formatting.
|
|
|
|
type cRich struct {
|
|
|
|
BodyPr aBodyPr `xml:"a:bodyPr,omitempty"`
|
|
|
|
LstStyle string `xml:"a:lstStyle,omitempty"`
|
|
|
|
P aP `xml:"a:p"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aBodyPr (Body Properties) directly maps the a:bodyPr element. This element
|
|
|
|
// defines the body properties for the text body within a shape.
|
|
|
|
type aBodyPr struct {
|
|
|
|
Anchor string `xml:"anchor,attr,omitempty"`
|
|
|
|
AnchorCtr bool `xml:"anchorCtr,attr"`
|
|
|
|
Rot int `xml:"rot,attr"`
|
|
|
|
BIns float64 `xml:"bIns,attr,omitempty"`
|
|
|
|
CompatLnSpc bool `xml:"compatLnSpc,attr,omitempty"`
|
|
|
|
ForceAA bool `xml:"forceAA,attr,omitempty"`
|
|
|
|
FromWordArt bool `xml:"fromWordArt,attr,omitempty"`
|
|
|
|
HorzOverflow string `xml:"horzOverflow,attr,omitempty"`
|
|
|
|
LIns float64 `xml:"lIns,attr,omitempty"`
|
|
|
|
NumCol int `xml:"numCol,attr,omitempty"`
|
|
|
|
RIns float64 `xml:"rIns,attr,omitempty"`
|
|
|
|
RtlCol bool `xml:"rtlCol,attr,omitempty"`
|
|
|
|
SpcCol int `xml:"spcCol,attr,omitempty"`
|
|
|
|
SpcFirstLastPara bool `xml:"spcFirstLastPara,attr"`
|
|
|
|
TIns float64 `xml:"tIns,attr,omitempty"`
|
|
|
|
Upright bool `xml:"upright,attr,omitempty"`
|
|
|
|
Vert string `xml:"vert,attr,omitempty"`
|
|
|
|
VertOverflow string `xml:"vertOverflow,attr,omitempty"`
|
|
|
|
Wrap string `xml:"wrap,attr,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aP (Paragraph) directly maps the a:p element. This element specifies a
|
|
|
|
// paragraph of content in the document.
|
|
|
|
type aP struct {
|
2017-04-30 20:03:43 +08:00
|
|
|
PPr *aPPr `xml:"a:pPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
R *aR `xml:"a:r"`
|
|
|
|
EndParaRPr *aEndParaRPr `xml:"a:endParaRPr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aPPr (Paragraph Properties) directly maps the a:pPr element. This element
|
|
|
|
// specifies a set of paragraph properties which shall be applied to the
|
|
|
|
// contents of the parent paragraph after all style/numbering/table properties
|
|
|
|
// have been applied to the text. These properties are defined as direct
|
|
|
|
// formatting, since they are directly applied to the paragraph and supersede
|
|
|
|
// any formatting from styles.
|
|
|
|
type aPPr struct {
|
2017-05-16 20:42:01 +08:00
|
|
|
DefRPr aRPr `xml:"a:defRPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// aSolidFill (Solid Fill) directly maps the solidFill element. This element
|
|
|
|
// specifies a solid color fill. The shape is filled entirely with the specified
|
|
|
|
// color.
|
|
|
|
type aSolidFill struct {
|
2017-05-16 20:42:01 +08:00
|
|
|
SchemeClr *aSchemeClr `xml:"a:schemeClr"`
|
|
|
|
SrgbClr *attrValString `xml:"a:srgbClr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// aSchemeClr (Scheme Color) directly maps the a:schemeClr element. This
|
|
|
|
// element specifies a color bound to a user's theme. As with all elements which
|
|
|
|
// define a color, it is possible to apply a list of color transforms to the
|
|
|
|
// base color defined.
|
|
|
|
type aSchemeClr struct {
|
|
|
|
Val string `xml:"val,attr,omitempty"`
|
|
|
|
LumMod *attrValInt `xml:"a:lumMod"`
|
|
|
|
LumOff *attrValInt `xml:"a:lumOff"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// attrValInt directly maps the val element with integer data type as an
|
2021-01-08 23:57:13 +08:00
|
|
|
// attribute.
|
2017-04-23 00:10:23 +08:00
|
|
|
type attrValInt struct {
|
2019-12-23 00:07:40 +08:00
|
|
|
Val *int `xml:"val,attr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2017-09-01 12:59:15 +08:00
|
|
|
// attrValFloat directly maps the val element with float64 data type as an
|
2021-01-08 23:57:13 +08:00
|
|
|
// attribute.
|
2017-09-01 12:59:15 +08:00
|
|
|
type attrValFloat struct {
|
2019-12-23 00:07:40 +08:00
|
|
|
Val *float64 `xml:"val,attr"`
|
2017-09-01 12:59:15 +08:00
|
|
|
}
|
|
|
|
|
2017-04-23 00:10:23 +08:00
|
|
|
// attrValBool directly maps the val element with boolean data type as an
|
2021-01-08 23:57:13 +08:00
|
|
|
// attribute.
|
2017-04-23 00:10:23 +08:00
|
|
|
type attrValBool struct {
|
2019-12-23 00:07:40 +08:00
|
|
|
Val *bool `xml:"val,attr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// attrValString directly maps the val element with string data type as an
|
2021-01-08 23:57:13 +08:00
|
|
|
// attribute.
|
2017-04-23 00:10:23 +08:00
|
|
|
type attrValString struct {
|
2019-12-23 00:07:40 +08:00
|
|
|
Val *string `xml:"val,attr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// aCs directly maps the a:cs element.
|
|
|
|
type aCs struct {
|
|
|
|
Typeface string `xml:"typeface,attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aEa directly maps the a:ea element.
|
|
|
|
type aEa struct {
|
|
|
|
Typeface string `xml:"typeface,attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aLatin (Latin Font) directly maps the a:latin element. This element
|
|
|
|
// specifies that a Latin font be used for a specific run of text. This font is
|
|
|
|
// specified with a typeface attribute much like the others but is specifically
|
|
|
|
// classified as a Latin font.
|
|
|
|
type aLatin struct {
|
|
|
|
Typeface string `xml:"typeface,attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aR directly maps the a:r element.
|
|
|
|
type aR struct {
|
|
|
|
RPr aRPr `xml:"a:rPr,omitempty"`
|
|
|
|
T string `xml:"a:t,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// aRPr (Run Properties) directly maps the rPr element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies a set of run properties which shall be applied to the contents of
|
|
|
|
// the parent run after all style formatting has been applied to the text. These
|
|
|
|
// properties are defined as direct formatting, since they are directly applied
|
|
|
|
// to the run and supersede any formatting from styles.
|
|
|
|
type aRPr struct {
|
2017-05-16 20:42:01 +08:00
|
|
|
AltLang string `xml:"altLang,attr,omitempty"`
|
|
|
|
B bool `xml:"b,attr"`
|
|
|
|
Baseline int `xml:"baseline,attr"`
|
|
|
|
Bmk string `xml:"bmk,attr,omitempty"`
|
|
|
|
Cap string `xml:"cap,attr,omitempty"`
|
|
|
|
Dirty bool `xml:"dirty,attr,omitempty"`
|
|
|
|
Err bool `xml:"err,attr,omitempty"`
|
|
|
|
I bool `xml:"i,attr"`
|
|
|
|
Kern int `xml:"kern,attr"`
|
|
|
|
Kumimoji bool `xml:"kumimoji,attr,omitempty"`
|
|
|
|
Lang string `xml:"lang,attr,omitempty"`
|
|
|
|
NoProof bool `xml:"noProof,attr,omitempty"`
|
|
|
|
NormalizeH bool `xml:"normalizeH,attr,omitempty"`
|
|
|
|
SmtClean bool `xml:"smtClean,attr,omitempty"`
|
|
|
|
SmtID uint64 `xml:"smtId,attr,omitempty"`
|
|
|
|
Spc int `xml:"spc,attr"`
|
|
|
|
Strike string `xml:"strike,attr,omitempty"`
|
2019-06-07 09:16:55 +08:00
|
|
|
Sz float64 `xml:"sz,attr,omitempty"`
|
2017-05-16 20:42:01 +08:00
|
|
|
U string `xml:"u,attr,omitempty"`
|
|
|
|
SolidFill *aSolidFill `xml:"a:solidFill"`
|
|
|
|
Latin *aLatin `xml:"a:latin"`
|
|
|
|
Ea *aEa `xml:"a:ea"`
|
|
|
|
Cs *aCs `xml:"a:cs"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cSpPr (Shape Properties) directly maps the spPr element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies the visual shape properties that can be applied to a shape. These
|
|
|
|
// properties include the shape fill, outline, geometry, effects, and 3D
|
|
|
|
// orientation.
|
|
|
|
type cSpPr struct {
|
|
|
|
NoFill *string `xml:"a:noFill"`
|
|
|
|
SolidFill *aSolidFill `xml:"a:solidFill"`
|
|
|
|
Ln *aLn `xml:"a:ln"`
|
|
|
|
Sp3D *aSp3D `xml:"a:sp3d"`
|
|
|
|
EffectLst *string `xml:"a:effectLst"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aSp3D (3-D Shape Properties) directly maps the a:sp3d element. This element
|
|
|
|
// defines the 3D properties associated with a particular shape in DrawingML.
|
|
|
|
// The 3D properties which can be applied to a shape are top and bottom bevels,
|
|
|
|
// a contour and an extrusion.
|
|
|
|
type aSp3D struct {
|
|
|
|
ContourW int `xml:"contourW,attr"`
|
|
|
|
ContourClr *aContourClr `xml:"a:contourClr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aContourClr (Contour Color) directly maps the a:contourClr element. This
|
|
|
|
// element defines the color for the contour on a shape. The contour of a shape
|
|
|
|
// is a solid filled line which surrounds the outer edges of the shape.
|
|
|
|
type aContourClr struct {
|
|
|
|
SchemeClr *aSchemeClr `xml:"a:schemeClr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aLn (Outline) directly maps the a:ln element. This element specifies an
|
|
|
|
// outline style that can be applied to a number of different objects such as
|
|
|
|
// shapes and text. The line allows for the specifying of many different types
|
|
|
|
// of outlines including even line dashes and bevels.
|
|
|
|
type aLn struct {
|
|
|
|
Algn string `xml:"algn,attr,omitempty"`
|
|
|
|
Cap string `xml:"cap,attr,omitempty"`
|
|
|
|
Cmpd string `xml:"cmpd,attr,omitempty"`
|
2018-10-27 23:19:59 +08:00
|
|
|
W int `xml:"w,attr,omitempty"`
|
2017-04-23 00:10:23 +08:00
|
|
|
NoFill string `xml:"a:noFill,omitempty"`
|
|
|
|
Round string `xml:"a:round,omitempty"`
|
|
|
|
SolidFill *aSolidFill `xml:"a:solidFill"`
|
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cTxPr (Text Properties) directly maps the txPr element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies text formatting. The lstStyle element is not supported.
|
|
|
|
type cTxPr struct {
|
|
|
|
BodyPr aBodyPr `xml:"a:bodyPr,omitempty"`
|
|
|
|
LstStyle string `xml:"a:lstStyle,omitempty"`
|
|
|
|
P aP `xml:"a:p,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// aEndParaRPr (End Paragraph Run Properties) directly maps the a:endParaRPr
|
|
|
|
// element. This element specifies the text run properties that are to be used
|
|
|
|
// if another run is inserted after the last run specified. This effectively
|
|
|
|
// saves the run property state so that it can be applied when the user enters
|
|
|
|
// additional text. If this element is omitted, then the application can
|
|
|
|
// determine which default properties to apply. It is recommended that this
|
|
|
|
// element be specified at the end of the list of text runs within the paragraph
|
|
|
|
// so that an orderly list is maintained.
|
|
|
|
type aEndParaRPr struct {
|
2017-04-30 20:03:43 +08:00
|
|
|
Lang string `xml:"lang,attr"`
|
|
|
|
AltLang string `xml:"altLang,attr,omitempty"`
|
|
|
|
Sz int `xml:"sz,attr,omitempty"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// cAutoTitleDeleted (Auto Title Is Deleted) directly maps the
|
2019-06-05 22:06:15 +08:00
|
|
|
// autoTitleDeleted element. This element specifies the title shall not be
|
2017-04-23 00:10:23 +08:00
|
|
|
// shown for this chart.
|
|
|
|
type cAutoTitleDeleted struct {
|
|
|
|
Val bool `xml:"val,attr"`
|
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cView3D (View In 3D) directly maps the view3D element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies the 3-D view of the chart.
|
|
|
|
type cView3D struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
RotX *attrValInt `xml:"rotX"`
|
|
|
|
RotY *attrValInt `xml:"rotY"`
|
2019-09-24 21:53:19 +08:00
|
|
|
RAngAx *attrValInt `xml:"rAngAx"`
|
2019-06-05 22:06:15 +08:00
|
|
|
DepthPercent *attrValInt `xml:"depthPercent"`
|
2019-06-15 20:55:56 +08:00
|
|
|
Perspective *attrValInt `xml:"perspective"`
|
2019-09-24 21:53:19 +08:00
|
|
|
ExtLst *xlsxExtLst `xml:"extLst"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cPlotArea directly maps the plotArea element. This element specifies the
|
2017-04-23 00:10:23 +08:00
|
|
|
// plot area of the chart.
|
|
|
|
type cPlotArea struct {
|
2019-06-15 20:55:56 +08:00
|
|
|
Layout *string `xml:"layout"`
|
|
|
|
AreaChart *cCharts `xml:"areaChart"`
|
|
|
|
Area3DChart *cCharts `xml:"area3DChart"`
|
|
|
|
BarChart *cCharts `xml:"barChart"`
|
|
|
|
Bar3DChart *cCharts `xml:"bar3DChart"`
|
2019-06-19 00:01:18 +08:00
|
|
|
BubbleChart *cCharts `xml:"bubbleChart"`
|
2019-06-15 20:55:56 +08:00
|
|
|
DoughnutChart *cCharts `xml:"doughnutChart"`
|
|
|
|
LineChart *cCharts `xml:"lineChart"`
|
|
|
|
PieChart *cCharts `xml:"pieChart"`
|
|
|
|
Pie3DChart *cCharts `xml:"pie3DChart"`
|
2020-01-14 00:33:36 +08:00
|
|
|
OfPieChart *cCharts `xml:"ofPieChart"`
|
2019-06-15 20:55:56 +08:00
|
|
|
RadarChart *cCharts `xml:"radarChart"`
|
|
|
|
ScatterChart *cCharts `xml:"scatterChart"`
|
|
|
|
Surface3DChart *cCharts `xml:"surface3DChart"`
|
|
|
|
SurfaceChart *cCharts `xml:"surfaceChart"`
|
|
|
|
CatAx []*cAxs `xml:"catAx"`
|
|
|
|
ValAx []*cAxs `xml:"valAx"`
|
|
|
|
SerAx []*cAxs `xml:"serAx"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// cCharts specifies the common element of the chart.
|
|
|
|
type cCharts struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
BarDir *attrValString `xml:"barDir"`
|
2019-06-19 00:01:18 +08:00
|
|
|
BubbleScale *attrValFloat `xml:"bubbleScale"`
|
2019-06-05 22:06:15 +08:00
|
|
|
Grouping *attrValString `xml:"grouping"`
|
|
|
|
RadarStyle *attrValString `xml:"radarStyle"`
|
|
|
|
ScatterStyle *attrValString `xml:"scatterStyle"`
|
2020-01-14 00:33:36 +08:00
|
|
|
OfPieType *attrValString `xml:"ofPieType"`
|
2019-06-05 22:06:15 +08:00
|
|
|
VaryColors *attrValBool `xml:"varyColors"`
|
2019-06-15 20:55:56 +08:00
|
|
|
Wireframe *attrValBool `xml:"wireframe"`
|
2019-06-05 22:06:15 +08:00
|
|
|
Ser *[]cSer `xml:"ser"`
|
2020-01-21 23:29:56 +08:00
|
|
|
SerLines *attrValString `xml:"serLines"`
|
2019-06-05 22:06:15 +08:00
|
|
|
DLbls *cDLbls `xml:"dLbls"`
|
2019-09-26 22:28:14 +08:00
|
|
|
Shape *attrValString `xml:"shape"`
|
2019-06-05 22:06:15 +08:00
|
|
|
HoleSize *attrValInt `xml:"holeSize"`
|
|
|
|
Smooth *attrValBool `xml:"smooth"`
|
|
|
|
Overlap *attrValInt `xml:"overlap"`
|
|
|
|
AxID []*attrValInt `xml:"axId"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// cAxs directly maps the catAx and valAx element.
|
2017-04-23 00:10:23 +08:00
|
|
|
type cAxs struct {
|
2019-06-15 20:55:56 +08:00
|
|
|
AxID *attrValInt `xml:"axId"`
|
|
|
|
Scaling *cScaling `xml:"scaling"`
|
|
|
|
Delete *attrValBool `xml:"delete"`
|
|
|
|
AxPos *attrValString `xml:"axPos"`
|
|
|
|
MajorGridlines *cChartLines `xml:"majorGridlines"`
|
2019-10-27 14:16:02 +08:00
|
|
|
MinorGridlines *cChartLines `xml:"minorGridlines"`
|
2019-06-15 20:55:56 +08:00
|
|
|
NumFmt *cNumFmt `xml:"numFmt"`
|
|
|
|
MajorTickMark *attrValString `xml:"majorTickMark"`
|
|
|
|
MinorTickMark *attrValString `xml:"minorTickMark"`
|
|
|
|
TickLblPos *attrValString `xml:"tickLblPos"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
|
|
|
TxPr *cTxPr `xml:"txPr"`
|
|
|
|
CrossAx *attrValInt `xml:"crossAx"`
|
|
|
|
Crosses *attrValString `xml:"crosses"`
|
|
|
|
CrossBetween *attrValString `xml:"crossBetween"`
|
2019-12-25 00:00:50 +08:00
|
|
|
MajorUnit *attrValFloat `xml:"majorUnit"`
|
|
|
|
MinorUnit *attrValFloat `xml:"minorUnit"`
|
2019-06-15 20:55:56 +08:00
|
|
|
Auto *attrValBool `xml:"auto"`
|
|
|
|
LblAlgn *attrValString `xml:"lblAlgn"`
|
|
|
|
LblOffset *attrValInt `xml:"lblOffset"`
|
2019-12-25 00:00:50 +08:00
|
|
|
TickLblSkip *attrValInt `xml:"tickLblSkip"`
|
|
|
|
TickMarkSkip *attrValInt `xml:"tickMarkSkip"`
|
2019-06-15 20:55:56 +08:00
|
|
|
NoMultiLvlLbl *attrValBool `xml:"noMultiLvlLbl"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// cChartLines directly maps the chart lines content model.
|
|
|
|
type cChartLines struct {
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
2019-06-05 22:06:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// cScaling directly maps the scaling element. This element contains
|
2017-04-23 00:10:23 +08:00
|
|
|
// additional axis settings.
|
|
|
|
type cScaling struct {
|
2020-07-11 01:07:41 +08:00
|
|
|
LogBase *attrValFloat `xml:"logBase"`
|
2019-06-05 22:06:15 +08:00
|
|
|
Orientation *attrValString `xml:"orientation"`
|
|
|
|
Max *attrValFloat `xml:"max"`
|
|
|
|
Min *attrValFloat `xml:"min"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cNumFmt (Numbering Format) directly maps the numFmt element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies number formatting for the parent element.
|
|
|
|
type cNumFmt struct {
|
|
|
|
FormatCode string `xml:"formatCode,attr"`
|
|
|
|
SourceLinked bool `xml:"sourceLinked,attr"`
|
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cSer directly maps the ser element. This element specifies a series on a
|
2017-04-23 00:10:23 +08:00
|
|
|
// chart.
|
|
|
|
type cSer struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
IDx *attrValInt `xml:"idx"`
|
|
|
|
Order *attrValInt `xml:"order"`
|
|
|
|
Tx *cTx `xml:"tx"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
|
|
|
DPt []*cDPt `xml:"dPt"`
|
|
|
|
DLbls *cDLbls `xml:"dLbls"`
|
|
|
|
Marker *cMarker `xml:"marker"`
|
|
|
|
InvertIfNegative *attrValBool `xml:"invertIfNegative"`
|
|
|
|
Cat *cCat `xml:"cat"`
|
|
|
|
Val *cVal `xml:"val"`
|
|
|
|
XVal *cCat `xml:"xVal"`
|
|
|
|
YVal *cVal `xml:"yVal"`
|
|
|
|
Smooth *attrValBool `xml:"smooth"`
|
2019-06-19 00:01:18 +08:00
|
|
|
BubbleSize *cVal `xml:"bubbleSize"`
|
|
|
|
Bubble3D *attrValBool `xml:"bubble3D"`
|
2019-06-05 22:06:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// cMarker (Marker) directly maps the marker element. This element specifies a
|
2017-04-23 00:10:23 +08:00
|
|
|
// data marker.
|
|
|
|
type cMarker struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
Symbol *attrValString `xml:"symbol"`
|
|
|
|
Size *attrValInt `xml:"size"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cDPt (Data Point) directly maps the dPt element. This element specifies a
|
2017-04-23 00:10:23 +08:00
|
|
|
// single data point.
|
|
|
|
type cDPt struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
IDx *attrValInt `xml:"idx"`
|
|
|
|
Bubble3D *attrValBool `xml:"bubble3D"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cCat (Category Axis Data) directly maps the cat element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies the data used for the category axis.
|
|
|
|
type cCat struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
StrRef *cStrRef `xml:"strRef"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cStrRef (String Reference) directly maps the strRef element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies a reference to data for a single data label or title with a cache
|
|
|
|
// of the last values used.
|
|
|
|
type cStrRef struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
F string `xml:"f"`
|
|
|
|
StrCache *cStrCache `xml:"strCache"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cStrCache (String Cache) directly maps the strCache element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies the last string data used for a chart.
|
|
|
|
type cStrCache struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
Pt []*cPt `xml:"pt"`
|
|
|
|
PtCount *attrValInt `xml:"ptCount"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cPt directly maps the pt element. This element specifies data for a
|
2017-04-23 00:10:23 +08:00
|
|
|
// particular data point.
|
|
|
|
type cPt struct {
|
|
|
|
IDx int `xml:"idx,attr"`
|
2019-06-05 22:06:15 +08:00
|
|
|
V *string `xml:"v"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cVal directly maps the val element. This element specifies the data values
|
2017-04-23 00:10:23 +08:00
|
|
|
// which shall be used to define the location of data markers on a chart.
|
|
|
|
type cVal struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
NumRef *cNumRef `xml:"numRef"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cNumRef directly maps the numRef element. This element specifies a
|
2017-04-23 00:10:23 +08:00
|
|
|
// reference to numeric data with a cache of the last values used.
|
|
|
|
type cNumRef struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
F string `xml:"f"`
|
|
|
|
NumCache *cNumCache `xml:"numCache"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cNumCache directly maps the numCache element. This element specifies the
|
2017-04-23 00:10:23 +08:00
|
|
|
// last data shown on the chart for a series.
|
|
|
|
type cNumCache struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
FormatCode string `xml:"formatCode"`
|
|
|
|
Pt []*cPt `xml:"pt"`
|
|
|
|
PtCount *attrValInt `xml:"ptCount"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cDLbls (Data Lables) directly maps the dLbls element. This element serves
|
2017-04-23 00:10:23 +08:00
|
|
|
// as a root element that specifies the settings for the data labels for an
|
|
|
|
// entire series or the entire chart. It contains child elements that specify
|
|
|
|
// the specific formatting and positioning settings.
|
|
|
|
type cDLbls struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
ShowLegendKey *attrValBool `xml:"showLegendKey"`
|
|
|
|
ShowVal *attrValBool `xml:"showVal"`
|
|
|
|
ShowCatName *attrValBool `xml:"showCatName"`
|
|
|
|
ShowSerName *attrValBool `xml:"showSerName"`
|
|
|
|
ShowPercent *attrValBool `xml:"showPercent"`
|
|
|
|
ShowBubbleSize *attrValBool `xml:"showBubbleSize"`
|
|
|
|
ShowLeaderLines *attrValBool `xml:"showLeaderLines"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cLegend (Legend) directly maps the legend element. This element specifies
|
2017-04-23 00:10:23 +08:00
|
|
|
// the legend.
|
|
|
|
type cLegend struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
Layout *string `xml:"layout"`
|
|
|
|
LegendPos *attrValString `xml:"legendPos"`
|
|
|
|
Overlay *attrValBool `xml:"overlay"`
|
|
|
|
SpPr *cSpPr `xml:"spPr"`
|
|
|
|
TxPr *cTxPr `xml:"txPr"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cPrintSettings directly maps the printSettings element. This element
|
2017-04-23 00:10:23 +08:00
|
|
|
// specifies the print settings for the chart.
|
|
|
|
type cPrintSettings struct {
|
2019-06-05 22:06:15 +08:00
|
|
|
HeaderFooter *string `xml:"headerFooter"`
|
|
|
|
PageMargins *cPageMargins `xml:"pageMargins"`
|
|
|
|
PageSetup *string `xml:"pageSetup"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:06:15 +08:00
|
|
|
// cPageMargins directly maps the pageMargins element. This element specifies
|
2017-04-23 00:10:23 +08:00
|
|
|
// the page margins for a chart.
|
|
|
|
type cPageMargins struct {
|
|
|
|
B float64 `xml:"b,attr"`
|
|
|
|
Footer float64 `xml:"footer,attr"`
|
|
|
|
Header float64 `xml:"header,attr"`
|
|
|
|
L float64 `xml:"l,attr"`
|
|
|
|
R float64 `xml:"r,attr"`
|
|
|
|
T float64 `xml:"t,attr"`
|
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// chartAxisOptions directly maps the format settings of the chart axis.
|
|
|
|
type chartAxisOptions struct {
|
2022-04-11 00:04:00 +08:00
|
|
|
None bool `json:"none"`
|
|
|
|
Crossing string `json:"crossing"`
|
|
|
|
MajorGridlines bool `json:"major_grid_lines"`
|
|
|
|
MinorGridlines bool `json:"minor_grid_lines"`
|
|
|
|
MajorTickMark string `json:"major_tick_mark"`
|
|
|
|
MinorTickMark string `json:"minor_tick_mark"`
|
|
|
|
MinorUnitType string `json:"minor_unit_type"`
|
|
|
|
MajorUnit float64 `json:"major_unit"`
|
|
|
|
MajorUnitType string `json:"major_unit_type"`
|
|
|
|
TickLabelSkip int `json:"tick_label_skip"`
|
|
|
|
DisplayUnits string `json:"display_units"`
|
|
|
|
DisplayUnitsVisible bool `json:"display_units_visible"`
|
|
|
|
DateAxis bool `json:"date_axis"`
|
|
|
|
ReverseOrder bool `json:"reverse_order"`
|
|
|
|
Maximum *float64 `json:"maximum"`
|
|
|
|
Minimum *float64 `json:"minimum"`
|
|
|
|
NumFormat string `json:"num_format"`
|
2017-05-24 14:17:35 +08:00
|
|
|
NumFont struct {
|
|
|
|
Color string `json:"color"`
|
|
|
|
Bold bool `json:"bold"`
|
|
|
|
Italic bool `json:"italic"`
|
|
|
|
Underline bool `json:"underline"`
|
|
|
|
} `json:"num_font"`
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
LogBase float64 `json:"logbase"`
|
|
|
|
NameLayout layoutOptions `json:"name_layout"`
|
2017-05-24 14:17:35 +08:00
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// chartDimensionOptions directly maps the dimension of the chart.
|
|
|
|
type chartDimensionOptions struct {
|
2018-05-09 19:44:04 +08:00
|
|
|
Width int `json:"width"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// chartOptions directly maps the format settings of the chart.
|
|
|
|
type chartOptions struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Series []chartSeriesOptions `json:"series"`
|
|
|
|
Format pictureOptions `json:"format"`
|
|
|
|
Dimension chartDimensionOptions `json:"dimension"`
|
|
|
|
Legend chartLegendOptions `json:"legend"`
|
|
|
|
Title chartTitleOptions `json:"title"`
|
|
|
|
VaryColors bool `json:"vary_colors"`
|
|
|
|
XAxis chartAxisOptions `json:"x_axis"`
|
|
|
|
YAxis chartAxisOptions `json:"y_axis"`
|
2021-04-10 00:15:39 +08:00
|
|
|
Chartarea struct {
|
2017-04-23 00:10:23 +08:00
|
|
|
Border struct {
|
|
|
|
None bool `json:"none"`
|
|
|
|
} `json:"border"`
|
|
|
|
Fill struct {
|
|
|
|
Color string `json:"color"`
|
|
|
|
} `json:"fill"`
|
|
|
|
Pattern struct {
|
|
|
|
Pattern string `json:"pattern"`
|
|
|
|
FgColor string `json:"fg_color"`
|
|
|
|
BgColor string `json:"bg_color"`
|
|
|
|
} `json:"pattern"`
|
|
|
|
} `json:"chartarea"`
|
|
|
|
Plotarea struct {
|
|
|
|
ShowBubbleSize bool `json:"show_bubble_size"`
|
|
|
|
ShowCatName bool `json:"show_cat_name"`
|
|
|
|
ShowLeaderLines bool `json:"show_leader_lines"`
|
|
|
|
ShowPercent bool `json:"show_percent"`
|
|
|
|
ShowSerName bool `json:"show_series_name"`
|
|
|
|
ShowVal bool `json:"show_val"`
|
|
|
|
Gradient struct {
|
|
|
|
Colors []string `json:"colors"`
|
|
|
|
} `json:"gradient"`
|
|
|
|
Border struct {
|
|
|
|
Color string `json:"color"`
|
|
|
|
Width int `json:"width"`
|
|
|
|
DashType string `json:"dash_type"`
|
|
|
|
} `json:"border"`
|
|
|
|
Fill struct {
|
|
|
|
Color string `json:"color"`
|
|
|
|
} `json:"fill"`
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
Layout layoutOptions `json:"layout"`
|
2017-04-23 00:10:23 +08:00
|
|
|
} `json:"plotarea"`
|
2020-01-16 01:05:22 +08:00
|
|
|
ShowBlanksAs string `json:"show_blanks_as"`
|
|
|
|
ShowHiddenData bool `json:"show_hidden_data"`
|
|
|
|
SetRotation int `json:"set_rotation"`
|
2022-03-09 12:34:48 +08:00
|
|
|
HoleSize int `json:"hole_size"`
|
2020-01-16 01:05:22 +08:00
|
|
|
order int
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// chartLegendOptions directly maps the format settings of the chart legend.
|
|
|
|
type chartLegendOptions struct {
|
|
|
|
None bool `json:"none"`
|
|
|
|
DeleteSeries []int `json:"delete_series"`
|
|
|
|
Font Font `json:"font"`
|
|
|
|
Layout layoutOptions `json:"layout"`
|
|
|
|
Position string `json:"position"`
|
|
|
|
ShowLegendEntry bool `json:"show_legend_entry"`
|
|
|
|
ShowLegendKey bool `json:"show_legend_key"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// chartSeriesOptions directly maps the format settings of the chart series.
|
|
|
|
type chartSeriesOptions struct {
|
2017-04-23 00:10:23 +08:00
|
|
|
Name string `json:"name"`
|
|
|
|
Categories string `json:"categories"`
|
|
|
|
Values string `json:"values"`
|
|
|
|
Line struct {
|
2022-08-24 00:00:47 +08:00
|
|
|
None bool `json:"none"`
|
|
|
|
Color string `json:"color"`
|
|
|
|
Smooth bool `json:"smooth"`
|
|
|
|
Width float64 `json:"width"`
|
2017-04-23 00:10:23 +08:00
|
|
|
} `json:"line"`
|
|
|
|
Marker struct {
|
2020-12-14 20:56:51 +08:00
|
|
|
Symbol string `json:"symbol"`
|
2018-10-27 23:19:59 +08:00
|
|
|
Size int `json:"size"`
|
2017-04-23 00:10:23 +08:00
|
|
|
Width float64 `json:"width"`
|
|
|
|
Border struct {
|
|
|
|
Color string `json:"color"`
|
|
|
|
None bool `json:"none"`
|
|
|
|
} `json:"border"`
|
|
|
|
Fill struct {
|
|
|
|
Color string `json:"color"`
|
|
|
|
None bool `json:"none"`
|
|
|
|
} `json:"fill"`
|
|
|
|
} `json:"marker"`
|
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// chartTitleOptions directly maps the format settings of the chart title.
|
|
|
|
type chartTitleOptions struct {
|
|
|
|
None bool `json:"none"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Overlay bool `json:"overlay"`
|
|
|
|
Layout layoutOptions `json:"layout"`
|
2017-08-01 16:35:18 +08:00
|
|
|
}
|
|
|
|
|
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:
Motivation and Context
When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:
- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily
Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`
Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`
Remove 54 exported types:
`AutoPageBreaks`, `BaseColWidth`, `BlackAndWhite`, `CodeName`, `CustomHeight`, `Date1904`, `DefaultColWidth`, `DefaultGridColor`, `DefaultRowHeight`, `EnableFormatConditionsCalculation`, `FilterPrivacy`, `FirstPageNumber`, `FitToHeight`, `FitToPage`, `FitToWidth`, `OutlineSummaryBelow`, `PageLayoutOption`, `PageLayoutOptionPtr`, `PageLayoutOrientation`, `PageLayoutPaperSize`, `PageLayoutScale`, `PageMarginBottom`, `PageMarginFooter`, `PageMarginHeader`, `PageMarginLeft`, `PageMarginRight`, `PageMarginsOptions`, `PageMarginsOptionsPtr`, `PageMarginTop`, `Published`, `RightToLeft`, `SheetFormatPrOptions`, `SheetFormatPrOptionsPtr`, `SheetPrOption`, `SheetPrOptionPtr`, `SheetViewOption`, `SheetViewOptionPtr`, `ShowFormulas`, `ShowGridLines`, `ShowRowColHeaders`, `ShowRuler`, `ShowZeros`, `TabColorIndexed`, `TabColorRGB`, `TabColorTheme`, `TabColorTint`, `ThickBottom`, `ThickTop`, `TopLeftCell`, `View`, `WorkbookPrOption`, `WorkbookPrOptionPtr`, `ZeroHeight` and `ZoomScale`
Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`
Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`
Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:00:21 +08:00
|
|
|
// layoutOptions directly maps the format settings of the element layout.
|
|
|
|
type layoutOptions struct {
|
2017-08-01 16:35:18 +08:00
|
|
|
X float64 `json:"x"`
|
|
|
|
Y float64 `json:"y"`
|
|
|
|
Width float64 `json:"width"`
|
|
|
|
Height float64 `json:"height"`
|
2017-04-23 00:10:23 +08:00
|
|
|
}
|