- Supplemental worksheet struct fields and field order adjustment

- Testing case for set and get doc properties
- Update charts struct XML tags
This commit is contained in:
xuri 2019-06-05 22:06:15 +08:00
parent db99373b25
commit cff16fa811
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
8 changed files with 296 additions and 170 deletions

View File

@ -1,8 +1,18 @@
// Copyright 2016 - 2019 The excelize Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
//
// Package excelize providing a set of functions that allow you to write to
// and read from XLSX files. Support reads and writes XLSX file generated by
// Microsoft Excel™ 2007 and later. Support save file without losing original
// charts of XLSX. This library needs Go version 1.8 or later.
package excelize package excelize
import "strings" import "strings"
// GetMergeCells provides a function to get all merged cells from a worksheet currently. // GetMergeCells provides a function to get all merged cells from a worksheet
// currently.
func (f *File) GetMergeCells(sheet string) ([]MergeCell, error) { func (f *File) GetMergeCells(sheet string) ([]MergeCell, error) {
var mergeCells []MergeCell var mergeCells []MergeCell
xlsx, err := f.workSheetReader(sheet) xlsx, err := f.workSheetReader(sheet)

0
docProps.go Executable file → Normal file
View File

56
docProps_test.go Normal file
View File

@ -0,0 +1,56 @@
// Copyright 2016 - 2019 The excelize Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
//
// Package excelize providing a set of functions that allow you to write to
// and read from XLSX files. Support reads and writes XLSX file generated by
// Microsoft Excel™ 2007 and later. Support save file without losing original
// charts of XLSX. This library needs Go version 1.8 or later.
package excelize
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSetDocProps(t *testing.T) {
f, err := OpenFile(filepath.Join("test", "Book1.xlsx"))
if !assert.NoError(t, err) {
t.FailNow()
}
assert.NoError(t, f.SetDocProps(&DocProperties{
Category: "category",
ContentStatus: "Draft",
Created: "2019-06-04T22:00:10Z",
Creator: "Go Excelize",
Description: "This file created by Go Excelize",
Identifier: "xlsx",
Keywords: "Spreadsheet",
LastModifiedBy: "Go Author",
Modified: "2019-06-04T22:00:10Z",
Revision: "0",
Subject: "Test Subject",
Title: "Test Title",
Language: "en-US",
Version: "1.0.0",
}))
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestSetDocProps.xlsx")))
f.XLSX["docProps/core.xml"] = nil
assert.EqualError(t, f.SetDocProps(&DocProperties{}), "EOF")
}
func TestGetDocProps(t *testing.T) {
f, err := OpenFile(filepath.Join("test", "Book1.xlsx"))
if !assert.NoError(t, err) {
t.FailNow()
}
props, err := f.GetDocProps()
assert.NoError(t, err)
assert.Equal(t, props.Creator, "Microsoft Office User")
f.XLSX["docProps/core.xml"] = nil
_, err = f.GetDocProps()
assert.EqualError(t, err, "EOF")
}

View File

@ -192,7 +192,7 @@ func TestBrokenFile(t *testing.T) {
t.Run("SaveAsEmptyStruct", func(t *testing.T) { t.Run("SaveAsEmptyStruct", func(t *testing.T) {
// Test write file with broken file struct with given path. // Test write file with broken file struct with given path.
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestBrokenFile.SaveAsEmptyStruct.xlsx"))) assert.NoError(t, f.SaveAs(filepath.Join("test", "BrokenFile.SaveAsEmptyStruct.xlsx")))
}) })
t.Run("OpenBadWorkbook", func(t *testing.T) { t.Run("OpenBadWorkbook", func(t *testing.T) {

View File

@ -11,66 +11,66 @@ package excelize
import "encoding/xml" import "encoding/xml"
// xlsxChartSpace directly maps the c:chartSpace element. The chart namespace in // xlsxChartSpace directly maps the chartSpace element. The chart namespace in
// DrawingML is for representing visualizations of numeric data with column // DrawingML is for representing visualizations of numeric data with column
// charts, pie charts, scatter charts, or other types of charts. // charts, pie charts, scatter charts, or other types of charts.
type xlsxChartSpace struct { type xlsxChartSpace struct {
XMLName xml.Name `xml:"c:chartSpace"` XMLName xml.Name `xml:"http://schemas.openxmlformats.org/drawingml/2006/chart chartSpace"`
XMLNSc string `xml:"xmlns:c,attr"` XMLNSc string `xml:"xmlns:c,attr"`
XMLNSa string `xml:"xmlns:a,attr"` XMLNSa string `xml:"xmlns:a,attr"`
XMLNSr string `xml:"xmlns:r,attr"` XMLNSr string `xml:"xmlns:r,attr"`
XMLNSc16r2 string `xml:"xmlns:c16r2,attr"` XMLNSc16r2 string `xml:"xmlns:c16r2,attr"`
Date1904 *attrValBool `xml:"c:date1904"` Date1904 *attrValBool `xml:"date1904"`
Lang *attrValString `xml:"c:lang"` Lang *attrValString `xml:"lang"`
RoundedCorners *attrValBool `xml:"c:roundedCorners"` RoundedCorners *attrValBool `xml:"roundedCorners"`
Chart cChart `xml:"c:chart"` Chart cChart `xml:"chart"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
TxPr *cTxPr `xml:"c:txPr"` TxPr *cTxPr `xml:"txPr"`
PrintSettings *cPrintSettings `xml:"c:printSettings"` PrintSettings *cPrintSettings `xml:"printSettings"`
} }
// cThicknessSpPr directly maps the element that specifies the thickness of the // cThicknessSpPr directly maps the element that specifies the thickness of
// walls or floor as a percentage of the largest dimension of the plot volume // the walls or floor as a percentage of the largest dimension of the plot
// and SpPr element. // volume and SpPr element.
type cThicknessSpPr struct { type cThicknessSpPr struct {
Thickness *attrValInt `xml:"c:thickness"` Thickness *attrValInt `xml:"thickness"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
} }
// cChart (Chart) directly maps the c:chart element. This element specifies a // cChart (Chart) directly maps the chart element. This element specifies a
// title. // title.
type cChart struct { type cChart struct {
Title *cTitle `xml:"c:title"` Title *cTitle `xml:"title"`
AutoTitleDeleted *cAutoTitleDeleted `xml:"c:autoTitleDeleted"` AutoTitleDeleted *cAutoTitleDeleted `xml:"autoTitleDeleted"`
View3D *cView3D `xml:"c:view3D"` View3D *cView3D `xml:"view3D"`
Floor *cThicknessSpPr `xml:"c:floor"` Floor *cThicknessSpPr `xml:"floor"`
SideWall *cThicknessSpPr `xml:"c:sideWall"` SideWall *cThicknessSpPr `xml:"sideWall"`
BackWall *cThicknessSpPr `xml:"c:backWall"` BackWall *cThicknessSpPr `xml:"backWall"`
PlotArea *cPlotArea `xml:"c:plotArea"` PlotArea *cPlotArea `xml:"plotArea"`
Legend *cLegend `xml:"c:legend"` Legend *cLegend `xml:"legend"`
PlotVisOnly *attrValBool `xml:"c:plotVisOnly"` PlotVisOnly *attrValBool `xml:"plotVisOnly"`
DispBlanksAs *attrValString `xml:"c:dispBlanksAs"` DispBlanksAs *attrValString `xml:"dispBlanksAs"`
ShowDLblsOverMax *attrValBool `xml:"c:showDLblsOverMax"` ShowDLblsOverMax *attrValBool `xml:"showDLblsOverMax"`
} }
// cTitle (Title) directly maps the c:title element. This element specifies a // cTitle (Title) directly maps the title element. This element specifies a
// title. // title.
type cTitle struct { type cTitle struct {
Tx cTx `xml:"c:tx,omitempty"` Tx cTx `xml:"tx,omitempty"`
Layout string `xml:"c:layout,omitempty"` Layout string `xml:"layout,omitempty"`
Overlay attrValBool `xml:"c:overlay,omitempty"` Overlay attrValBool `xml:"overlay,omitempty"`
SpPr cSpPr `xml:"c:spPr,omitempty"` SpPr cSpPr `xml:"spPr,omitempty"`
TxPr cTxPr `xml:"c:txPr,omitempty"` TxPr cTxPr `xml:"txPr,omitempty"`
} }
// cTx (Chart Text) directly maps the c:tx element. This element specifies text // cTx (Chart Text) directly maps the tx element. This element specifies text
// to use on a chart, including rich text formatting. // to use on a chart, including rich text formatting.
type cTx struct { type cTx struct {
StrRef *cStrRef `xml:"c:strRef"` StrRef *cStrRef `xml:"strRef"`
Rich *cRich `xml:"c:rich,omitempty"` Rich *cRich `xml:"rich,omitempty"`
} }
// cRich (Rich Text) directly maps the c:rich element. This element contains a // cRich (Rich Text) directly maps the rich element. This element contains a
// string with rich text formatting. // string with rich text formatting.
type cRich struct { type cRich struct {
BodyPr aBodyPr `xml:"a:bodyPr,omitempty"` BodyPr aBodyPr `xml:"a:bodyPr,omitempty"`
@ -186,7 +186,7 @@ type aR struct {
T string `xml:"a:t,omitempty"` T string `xml:"a:t,omitempty"`
} }
// aRPr (Run Properties) directly maps the c:rPr element. This element // aRPr (Run Properties) directly maps the rPr element. This element
// specifies a set of run properties which shall be applied to the contents of // 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 // 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 // properties are defined as direct formatting, since they are directly applied
@ -217,7 +217,7 @@ type aRPr struct {
Cs *aCs `xml:"a:cs"` Cs *aCs `xml:"a:cs"`
} }
// cSpPr (Shape Properties) directly maps the c:spPr element. This element // cSpPr (Shape Properties) directly maps the spPr element. This element
// specifies the visual shape properties that can be applied to a shape. These // specifies the visual shape properties that can be applied to a shape. These
// properties include the shape fill, outline, geometry, effects, and 3D // properties include the shape fill, outline, geometry, effects, and 3D
// orientation. // orientation.
@ -259,7 +259,7 @@ type aLn struct {
SolidFill *aSolidFill `xml:"a:solidFill"` SolidFill *aSolidFill `xml:"a:solidFill"`
} }
// cTxPr (Text Properties) directly maps the c:txPr element. This element // cTxPr (Text Properties) directly maps the txPr element. This element
// specifies text formatting. The lstStyle element is not supported. // specifies text formatting. The lstStyle element is not supported.
type cTxPr struct { type cTxPr struct {
BodyPr aBodyPr `xml:"a:bodyPr,omitempty"` BodyPr aBodyPr `xml:"a:bodyPr,omitempty"`
@ -282,207 +282,207 @@ type aEndParaRPr struct {
} }
// cAutoTitleDeleted (Auto Title Is Deleted) directly maps the // cAutoTitleDeleted (Auto Title Is Deleted) directly maps the
// c:autoTitleDeleted element. This element specifies the title shall not be // autoTitleDeleted element. This element specifies the title shall not be
// shown for this chart. // shown for this chart.
type cAutoTitleDeleted struct { type cAutoTitleDeleted struct {
Val bool `xml:"val,attr"` Val bool `xml:"val,attr"`
} }
// cView3D (View In 3D) directly maps the c:view3D element. This element // cView3D (View In 3D) directly maps the view3D element. This element
// specifies the 3-D view of the chart. // specifies the 3-D view of the chart.
type cView3D struct { type cView3D struct {
RotX *attrValInt `xml:"c:rotX"` RotX *attrValInt `xml:"rotX"`
RotY *attrValInt `xml:"c:rotY"` RotY *attrValInt `xml:"rotY"`
DepthPercent *attrValInt `xml:"c:depthPercent"` DepthPercent *attrValInt `xml:"depthPercent"`
RAngAx *attrValInt `xml:"c:rAngAx"` RAngAx *attrValInt `xml:"rAngAx"`
} }
// cPlotArea directly maps the c:plotArea element. This element specifies the // cPlotArea directly maps the plotArea element. This element specifies the
// plot area of the chart. // plot area of the chart.
type cPlotArea struct { type cPlotArea struct {
Layout *string `xml:"c:layout"` Layout *string `xml:"layout"`
AreaChart *cCharts `xml:"c:areaChart"` AreaChart *cCharts `xml:"areaChart"`
Area3DChart *cCharts `xml:"c:area3DChart"` Area3DChart *cCharts `xml:"area3DChart"`
BarChart *cCharts `xml:"c:barChart"` BarChart *cCharts `xml:"barChart"`
Bar3DChart *cCharts `xml:"c:bar3DChart"` Bar3DChart *cCharts `xml:"bar3DChart"`
DoughnutChart *cCharts `xml:"c:doughnutChart"` DoughnutChart *cCharts `xml:"doughnutChart"`
LineChart *cCharts `xml:"c:lineChart"` LineChart *cCharts `xml:"lineChart"`
PieChart *cCharts `xml:"c:pieChart"` PieChart *cCharts `xml:"pieChart"`
Pie3DChart *cCharts `xml:"c:pie3DChart"` Pie3DChart *cCharts `xml:"pie3DChart"`
RadarChart *cCharts `xml:"c:radarChart"` RadarChart *cCharts `xml:"radarChart"`
ScatterChart *cCharts `xml:"c:scatterChart"` ScatterChart *cCharts `xml:"scatterChart"`
CatAx []*cAxs `xml:"c:catAx"` CatAx []*cAxs `xml:"catAx"`
ValAx []*cAxs `xml:"c:valAx"` ValAx []*cAxs `xml:"valAx"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
} }
// cCharts specifies the common element of the chart. // cCharts specifies the common element of the chart.
type cCharts struct { type cCharts struct {
BarDir *attrValString `xml:"c:barDir"` BarDir *attrValString `xml:"barDir"`
Grouping *attrValString `xml:"c:grouping"` Grouping *attrValString `xml:"grouping"`
RadarStyle *attrValString `xml:"c:radarStyle"` RadarStyle *attrValString `xml:"radarStyle"`
ScatterStyle *attrValString `xml:"c:scatterStyle"` ScatterStyle *attrValString `xml:"scatterStyle"`
VaryColors *attrValBool `xml:"c:varyColors"` VaryColors *attrValBool `xml:"varyColors"`
Ser *[]cSer `xml:"c:ser"` Ser *[]cSer `xml:"ser"`
DLbls *cDLbls `xml:"c:dLbls"` DLbls *cDLbls `xml:"dLbls"`
HoleSize *attrValInt `xml:"c:holeSize"` HoleSize *attrValInt `xml:"holeSize"`
Smooth *attrValBool `xml:"c:smooth"` Smooth *attrValBool `xml:"smooth"`
Overlap *attrValInt `xml:"c:overlap"` Overlap *attrValInt `xml:"overlap"`
AxID []*attrValInt `xml:"c:axId"` AxID []*attrValInt `xml:"axId"`
} }
// cAxs directly maps the c:catAx and c:valAx element. // cAxs directly maps the catAx and valAx element.
type cAxs struct { type cAxs struct {
AxID *attrValInt `xml:"c:axId"` AxID *attrValInt `xml:"axId"`
Scaling *cScaling `xml:"c:scaling"` Scaling *cScaling `xml:"scaling"`
Delete *attrValBool `xml:"c:delete"` Delete *attrValBool `xml:"delete"`
AxPos *attrValString `xml:"c:axPos"` AxPos *attrValString `xml:"axPos"`
NumFmt *cNumFmt `xml:"c:numFmt"` NumFmt *cNumFmt `xml:"numFmt"`
MajorTickMark *attrValString `xml:"c:majorTickMark"` MajorTickMark *attrValString `xml:"majorTickMark"`
MinorTickMark *attrValString `xml:"c:minorTickMark"` MinorTickMark *attrValString `xml:"minorTickMark"`
TickLblPos *attrValString `xml:"c:tickLblPos"` TickLblPos *attrValString `xml:"tickLblPos"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
TxPr *cTxPr `xml:"c:txPr"` TxPr *cTxPr `xml:"txPr"`
CrossAx *attrValInt `xml:"c:crossAx"` CrossAx *attrValInt `xml:"crossAx"`
Crosses *attrValString `xml:"c:crosses"` Crosses *attrValString `xml:"crosses"`
CrossBetween *attrValString `xml:"c:crossBetween"` CrossBetween *attrValString `xml:"crossBetween"`
Auto *attrValBool `xml:"c:auto"` Auto *attrValBool `xml:"auto"`
LblAlgn *attrValString `xml:"c:lblAlgn"` LblAlgn *attrValString `xml:"lblAlgn"`
LblOffset *attrValInt `xml:"c:lblOffset"` LblOffset *attrValInt `xml:"lblOffset"`
NoMultiLvlLbl *attrValBool `xml:"c:noMultiLvlLbl"` NoMultiLvlLbl *attrValBool `xml:"noMultiLvlLbl"`
} }
// cScaling directly maps the c:scaling element. This element contains // cScaling directly maps the scaling element. This element contains
// additional axis settings. // additional axis settings.
type cScaling struct { type cScaling struct {
Orientation *attrValString `xml:"c:orientation"` Orientation *attrValString `xml:"orientation"`
Max *attrValFloat `xml:"c:max"` Max *attrValFloat `xml:"max"`
Min *attrValFloat `xml:"c:min"` Min *attrValFloat `xml:"min"`
} }
// cNumFmt (Numbering Format) directly maps the c:numFmt element. This element // cNumFmt (Numbering Format) directly maps the numFmt element. This element
// specifies number formatting for the parent element. // specifies number formatting for the parent element.
type cNumFmt struct { type cNumFmt struct {
FormatCode string `xml:"formatCode,attr"` FormatCode string `xml:"formatCode,attr"`
SourceLinked bool `xml:"sourceLinked,attr"` SourceLinked bool `xml:"sourceLinked,attr"`
} }
// cSer directly maps the c:ser element. This element specifies a series on a // cSer directly maps the ser element. This element specifies a series on a
// chart. // chart.
type cSer struct { type cSer struct {
IDx *attrValInt `xml:"c:idx"` IDx *attrValInt `xml:"idx"`
Order *attrValInt `xml:"c:order"` Order *attrValInt `xml:"order"`
Tx *cTx `xml:"c:tx"` Tx *cTx `xml:"tx"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
DPt []*cDPt `xml:"c:dPt"` DPt []*cDPt `xml:"dPt"`
DLbls *cDLbls `xml:"c:dLbls"` DLbls *cDLbls `xml:"dLbls"`
Marker *cMarker `xml:"c:marker"` Marker *cMarker `xml:"marker"`
InvertIfNegative *attrValBool `xml:"c:invertIfNegative"` InvertIfNegative *attrValBool `xml:"invertIfNegative"`
Cat *cCat `xml:"c:cat"` Cat *cCat `xml:"cat"`
Val *cVal `xml:"c:val"` Val *cVal `xml:"val"`
XVal *cCat `xml:"c:xVal"` XVal *cCat `xml:"xVal"`
YVal *cVal `xml:"c:yVal"` YVal *cVal `xml:"yVal"`
Smooth *attrValBool `xml:"c:smooth"` Smooth *attrValBool `xml:"smooth"`
} }
// cMarker (Marker) directly maps the c:marker element. This element specifies a // cMarker (Marker) directly maps the marker element. This element specifies a
// data marker. // data marker.
type cMarker struct { type cMarker struct {
Symbol *attrValString `xml:"c:symbol"` Symbol *attrValString `xml:"symbol"`
Size *attrValInt `xml:"c:size"` Size *attrValInt `xml:"size"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
} }
// cDPt (Data Point) directly maps the c:dPt element. This element specifies a // cDPt (Data Point) directly maps the dPt element. This element specifies a
// single data point. // single data point.
type cDPt struct { type cDPt struct {
IDx *attrValInt `xml:"c:idx"` IDx *attrValInt `xml:"idx"`
Bubble3D *attrValBool `xml:"c:bubble3D"` Bubble3D *attrValBool `xml:"bubble3D"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
} }
// cCat (Category Axis Data) directly maps the c:cat element. This element // cCat (Category Axis Data) directly maps the cat element. This element
// specifies the data used for the category axis. // specifies the data used for the category axis.
type cCat struct { type cCat struct {
StrRef *cStrRef `xml:"c:strRef"` StrRef *cStrRef `xml:"strRef"`
} }
// cStrRef (String Reference) directly maps the c:strRef element. This element // cStrRef (String Reference) directly maps the strRef element. This element
// specifies a reference to data for a single data label or title with a cache // specifies a reference to data for a single data label or title with a cache
// of the last values used. // of the last values used.
type cStrRef struct { type cStrRef struct {
F string `xml:"c:f"` F string `xml:"f"`
StrCache *cStrCache `xml:"c:strCache"` StrCache *cStrCache `xml:"strCache"`
} }
// cStrCache (String Cache) directly maps the c:strCache element. This element // cStrCache (String Cache) directly maps the strCache element. This element
// specifies the last string data used for a chart. // specifies the last string data used for a chart.
type cStrCache struct { type cStrCache struct {
Pt []*cPt `xml:"c:pt"` Pt []*cPt `xml:"pt"`
PtCount *attrValInt `xml:"c:ptCount"` PtCount *attrValInt `xml:"ptCount"`
} }
// cPt directly maps the c:pt element. This element specifies data for a // cPt directly maps the pt element. This element specifies data for a
// particular data point. // particular data point.
type cPt struct { type cPt struct {
IDx int `xml:"idx,attr"` IDx int `xml:"idx,attr"`
V *string `xml:"c:v"` V *string `xml:"v"`
} }
// cVal directly maps the c:val element. This element specifies the data values // cVal directly maps the val element. This element specifies the data values
// which shall be used to define the location of data markers on a chart. // which shall be used to define the location of data markers on a chart.
type cVal struct { type cVal struct {
NumRef *cNumRef `xml:"c:numRef"` NumRef *cNumRef `xml:"numRef"`
} }
// cNumRef directly maps the c:numRef element. This element specifies a // cNumRef directly maps the numRef element. This element specifies a
// reference to numeric data with a cache of the last values used. // reference to numeric data with a cache of the last values used.
type cNumRef struct { type cNumRef struct {
F string `xml:"c:f"` F string `xml:"f"`
NumCache *cNumCache `xml:"c:numCache"` NumCache *cNumCache `xml:"numCache"`
} }
// cNumCache directly maps the c:numCache element. This element specifies the // cNumCache directly maps the numCache element. This element specifies the
// last data shown on the chart for a series. // last data shown on the chart for a series.
type cNumCache struct { type cNumCache struct {
FormatCode string `xml:"c:formatCode"` FormatCode string `xml:"formatCode"`
Pt []*cPt `xml:"c:pt"` Pt []*cPt `xml:"pt"`
PtCount *attrValInt `xml:"c:ptCount"` PtCount *attrValInt `xml:"ptCount"`
} }
// cDLbls (Data Lables) directly maps the c:dLbls element. This element serves // cDLbls (Data Lables) directly maps the dLbls element. This element serves
// as a root element that specifies the settings for the data labels for an // 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 // entire series or the entire chart. It contains child elements that specify
// the specific formatting and positioning settings. // the specific formatting and positioning settings.
type cDLbls struct { type cDLbls struct {
ShowLegendKey *attrValBool `xml:"c:showLegendKey"` ShowLegendKey *attrValBool `xml:"showLegendKey"`
ShowVal *attrValBool `xml:"c:showVal"` ShowVal *attrValBool `xml:"showVal"`
ShowCatName *attrValBool `xml:"c:showCatName"` ShowCatName *attrValBool `xml:"showCatName"`
ShowSerName *attrValBool `xml:"c:showSerName"` ShowSerName *attrValBool `xml:"showSerName"`
ShowPercent *attrValBool `xml:"c:showPercent"` ShowPercent *attrValBool `xml:"showPercent"`
ShowBubbleSize *attrValBool `xml:"c:showBubbleSize"` ShowBubbleSize *attrValBool `xml:"showBubbleSize"`
ShowLeaderLines *attrValBool `xml:"c:showLeaderLines"` ShowLeaderLines *attrValBool `xml:"showLeaderLines"`
} }
// cLegend (Legend) directly maps the c:legend element. This element specifies // cLegend (Legend) directly maps the legend element. This element specifies
// the legend. // the legend.
type cLegend struct { type cLegend struct {
Layout *string `xml:"c:layout"` Layout *string `xml:"layout"`
LegendPos *attrValString `xml:"c:legendPos"` LegendPos *attrValString `xml:"legendPos"`
Overlay *attrValBool `xml:"c:overlay"` Overlay *attrValBool `xml:"overlay"`
SpPr *cSpPr `xml:"c:spPr"` SpPr *cSpPr `xml:"spPr"`
TxPr *cTxPr `xml:"c:txPr"` TxPr *cTxPr `xml:"txPr"`
} }
// cPrintSettings directly maps the c:printSettings element. This element // cPrintSettings directly maps the printSettings element. This element
// specifies the print settings for the chart. // specifies the print settings for the chart.
type cPrintSettings struct { type cPrintSettings struct {
HeaderFooter *string `xml:"c:headerFooter"` HeaderFooter *string `xml:"headerFooter"`
PageMargins *cPageMargins `xml:"c:pageMargins"` PageMargins *cPageMargins `xml:"pageMargins"`
PageSetup *string `xml:"c:pageSetup"` PageSetup *string `xml:"pageSetup"`
} }
// cPageMargins directly maps the c:pageMargins element. This element specifies // cPageMargins directly maps the pageMargins element. This element specifies
// the page margins for a chart. // the page margins for a chart.
type cPageMargins struct { type cPageMargins struct {
B float64 `xml:"b,attr"` B float64 `xml:"b,attr"`

0
xmlCore.go Executable file → Normal file
View File

0
xmlDrawing.go Executable file → Normal file
View File

View File

@ -24,6 +24,7 @@ type xlsxWorksheet struct {
SheetData xlsxSheetData `xml:"sheetData"` SheetData xlsxSheetData `xml:"sheetData"`
SheetProtection *xlsxSheetProtection `xml:"sheetProtection"` SheetProtection *xlsxSheetProtection `xml:"sheetProtection"`
AutoFilter *xlsxAutoFilter `xml:"autoFilter"` AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
CustomSheetViews *xlsxCustomSheetViews `xml:"customSheetViews"`
MergeCells *xlsxMergeCells `xml:"mergeCells"` MergeCells *xlsxMergeCells `xml:"mergeCells"`
PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"` PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"`
ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"` ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"`
@ -33,6 +34,8 @@ type xlsxWorksheet struct {
PageMargins *xlsxPageMargins `xml:"pageMargins"` PageMargins *xlsxPageMargins `xml:"pageMargins"`
PageSetUp *xlsxPageSetUp `xml:"pageSetup"` PageSetUp *xlsxPageSetUp `xml:"pageSetup"`
HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"` HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"`
RowBreaks *xlsxBreaks `xml:"rowBreaks"`
ColBreaks *xlsxBreaks `xml:"colBreaks"`
Drawing *xlsxDrawing `xml:"drawing"` Drawing *xlsxDrawing `xml:"drawing"`
LegacyDrawing *xlsxLegacyDrawing `xml:"legacyDrawing"` LegacyDrawing *xlsxLegacyDrawing `xml:"legacyDrawing"`
Picture *xlsxPicture `xml:"picture"` Picture *xlsxPicture `xml:"picture"`
@ -299,6 +302,63 @@ type xlsxRow struct {
C []xlsxC `xml:"c"` C []xlsxC `xml:"c"`
} }
// xlsxCustomSheetViews directly maps the customSheetViews element. This is a
// collection of custom sheet views.
type xlsxCustomSheetViews struct {
CustomSheetView []*xlsxCustomSheetView `xml:"customSheetView"`
}
// xlsxBrk directly maps the row or column break to use when paginating a
// worksheet.
type xlsxBrk struct {
ID int `xml:"id,attr,omitempty"`
Min int `xml:"min,attr,omitempty"`
Max int `xml:"max,attr,omitempty"`
Man bool `xml:"man,attr,omitempty"`
Pt bool `xml:"pt,attr,omitempty"`
}
// xlsxBreaks directly maps a collection of the row or column breaks.
type xlsxBreaks struct {
Brk *xlsxBrk `xml:"brk"`
Count int `xml:"count,attr,omitempty"`
ManualBreakCount int `xml:"manualBreakCount,attr,omitempty"`
}
// xlsxCustomSheetView directly maps the customSheetView element.
type xlsxCustomSheetView struct {
Pane *xlsxPane `xml:"pane"`
Selection *xlsxSelection `xml:"selection"`
RowBreaks *xlsxBreaks `xml:"rowBreaks"`
ColBreaks *xlsxBreaks `xml:"colBreaks"`
PageMargins *xlsxPageMargins `xml:"pageMargins"`
PrintOptions *xlsxPrintOptions `xml:"printOptions"`
PageSetup *xlsxPageSetUp `xml:"pageSetup"`
HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"`
AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
ExtLst *xlsxExt `xml:"extLst"`
GUID string `xml:"guid,attr"`
Scale int `xml:"scale,attr,omitempty"`
ColorID int `xml:"colorId,attr,omitempty"`
ShowPageBreaks bool `xml:"showPageBreaks,attr,omitempty"`
ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
ShowGridLines bool `xml:"showGridLines,attr,omitempty"`
ShowRowCol bool `xml:"showRowCol,attr,omitempty"`
OutlineSymbols bool `xml:"outlineSymbols,attr,omitempty"`
ZeroValues bool `xml:"zeroValues,attr,omitempty"`
FitToPage bool `xml:"fitToPage,attr,omitempty"`
PrintArea bool `xml:"printArea,attr,omitempty"`
Filter bool `xml:"filter,attr,omitempty"`
ShowAutoFilter bool `xml:"showAutoFilter,attr,omitempty"`
HiddenRows bool `xml:"hiddenRows,attr,omitempty"`
HiddenColumns bool `xml:"hiddenColumns,attr,omitempty"`
State string `xml:"state,attr,omitempty"`
FilterUnique bool `xml:"filterUnique,attr,omitempty"`
View string `xml:"view,attr,omitempty"`
ShowRuler bool `xml:"showRuler,attr,omitempty"`
TopLeftCell string `xml:"topLeftCell,attr,omitempty"`
}
// xlsxMergeCell directly maps the mergeCell element. A single merged cell. // xlsxMergeCell directly maps the mergeCell element. A single merged cell.
type xlsxMergeCell struct { type xlsxMergeCell struct {
Ref string `xml:"ref,attr,omitempty"` Ref string `xml:"ref,attr,omitempty"`
@ -389,26 +449,26 @@ type xlsxF struct {
// enforce when the sheet is protected. // enforce when the sheet is protected.
type xlsxSheetProtection struct { type xlsxSheetProtection struct {
AlgorithmName string `xml:"algorithmName,attr,omitempty"` AlgorithmName string `xml:"algorithmName,attr,omitempty"`
AutoFilter bool `xml:"autoFilter,attr,omitempty"` Password string `xml:"password,attr,omitempty"`
DeleteColumns bool `xml:"deleteColumns,attr,omitempty"` HashValue string `xml:"hashValue,attr,omitempty"`
DeleteRows bool `xml:"deleteRows,attr,omitempty"` SaltValue string `xml:"saltValue,attr,omitempty"`
SpinCount int `xml:"spinCount,attr,omitempty"`
Sheet bool `xml:"sheet,attr,omitempty"`
Objects bool `xml:"objects,attr,omitempty"`
Scenarios bool `xml:"scenarios,attr,omitempty"`
FormatCells bool `xml:"formatCells,attr,omitempty"` FormatCells bool `xml:"formatCells,attr,omitempty"`
FormatColumns bool `xml:"formatColumns,attr,omitempty"` FormatColumns bool `xml:"formatColumns,attr,omitempty"`
FormatRows bool `xml:"formatRows,attr,omitempty"` FormatRows bool `xml:"formatRows,attr,omitempty"`
HashValue string `xml:"hashValue,attr,omitempty"`
InsertColumns bool `xml:"insertColumns,attr,omitempty"` InsertColumns bool `xml:"insertColumns,attr,omitempty"`
InsertHyperlinks bool `xml:"insertHyperlinks,attr,omitempty"`
InsertRows bool `xml:"insertRows,attr,omitempty"` InsertRows bool `xml:"insertRows,attr,omitempty"`
Objects bool `xml:"objects,attr,omitempty"` InsertHyperlinks bool `xml:"insertHyperlinks,attr,omitempty"`
Password string `xml:"password,attr,omitempty"` DeleteColumns bool `xml:"deleteColumns,attr,omitempty"`
PivotTables bool `xml:"pivotTables,attr,omitempty"` DeleteRows bool `xml:"deleteRows,attr,omitempty"`
SaltValue string `xml:"saltValue,attr,omitempty"`
Scenarios bool `xml:"scenarios,attr,omitempty"`
SelectLockedCells bool `xml:"selectLockedCells,attr,omitempty"` SelectLockedCells bool `xml:"selectLockedCells,attr,omitempty"`
SelectUnlockedCells bool `xml:"selectUnlockedCells,attr,omitempty"`
Sheet bool `xml:"sheet,attr,omitempty"`
Sort bool `xml:"sort,attr,omitempty"` Sort bool `xml:"sort,attr,omitempty"`
SpinCount int `xml:"spinCount,attr,omitempty"` AutoFilter bool `xml:"autoFilter,attr,omitempty"`
PivotTables bool `xml:"pivotTables,attr,omitempty"`
SelectUnlockedCells bool `xml:"selectUnlockedCells,attr,omitempty"`
} }
// xlsxPhoneticPr (Phonetic Properties) represents a collection of phonetic // xlsxPhoneticPr (Phonetic Properties) represents a collection of phonetic