Simplify code and update unit tests.
This commit is contained in:
parent
b327eb54dc
commit
6626a26f7b
|
@ -598,6 +598,9 @@ func TestGetPicture(t *testing.T) {
|
||||||
// Try to get picture from a cell that doesn't contain an image.
|
// Try to get picture from a cell that doesn't contain an image.
|
||||||
file, raw = xlsx.GetPicture("Sheet2", "A2")
|
file, raw = xlsx.GetPicture("Sheet2", "A2")
|
||||||
t.Log(file, len(raw))
|
t.Log(file, len(raw))
|
||||||
|
xlsx.getDrawingRelationships("xl/worksheets/_rels/sheet1.xml.rels", "rId8")
|
||||||
|
xlsx.getDrawingRelationships("", "")
|
||||||
|
xlsx.getSheetRelationshipsTargetByID("", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSheetVisibility(t *testing.T) {
|
func TestSheetVisibility(t *testing.T) {
|
||||||
|
|
3
sheet.go
3
sheet.go
|
@ -629,11 +629,10 @@ func (f *File) SetPanes(sheet, panes string) {
|
||||||
// xlsx.GetSheetVisible("Sheet1")
|
// xlsx.GetSheetVisible("Sheet1")
|
||||||
//
|
//
|
||||||
func (f *File) GetSheetVisible(name string) bool {
|
func (f *File) GetSheetVisible(name string) bool {
|
||||||
name = trimSheetName(name)
|
|
||||||
content := f.workbookReader()
|
content := f.workbookReader()
|
||||||
visible := false
|
visible := false
|
||||||
for k, v := range content.Sheets.Sheet {
|
for k, v := range content.Sheets.Sheet {
|
||||||
if v.Name == name {
|
if v.Name == trimSheetName(name) {
|
||||||
if content.Sheets.Sheet[k].State == "" || content.Sheets.Sheet[k].State == "visible" {
|
if content.Sheets.Sheet[k].State == "" || content.Sheets.Sheet[k].State == "visible" {
|
||||||
visible = true
|
visible = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file contains default templates for XML files we don't yet
|
// This file contains default templates for XML files we don't yet populated
|
||||||
// populated based on content.
|
// based on content.
|
||||||
|
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
|
|
52
xmlChart.go
52
xmlChart.go
|
@ -491,10 +491,7 @@ type formatChartAxis struct {
|
||||||
Italic bool `json:"italic"`
|
Italic bool `json:"italic"`
|
||||||
Underline bool `json:"underline"`
|
Underline bool `json:"underline"`
|
||||||
} `json:"num_font"`
|
} `json:"num_font"`
|
||||||
NameLayout struct {
|
NameLayout formatLayout `json:"name_layout"`
|
||||||
X float64 `json:"x"`
|
|
||||||
Y float64 `json:"y"`
|
|
||||||
} `json:"name_layout"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatChart directly maps the format settings of the chart.
|
// formatChart directly maps the format settings of the chart.
|
||||||
|
@ -537,12 +534,7 @@ type formatChart struct {
|
||||||
Fill struct {
|
Fill struct {
|
||||||
Color string `json:"color"`
|
Color string `json:"color"`
|
||||||
} `json:"fill"`
|
} `json:"fill"`
|
||||||
Layout struct {
|
Layout formatLayout `json:"layout"`
|
||||||
X float64 `json:"x"`
|
|
||||||
Y float64 `json:"y"`
|
|
||||||
Width float64 `json:"width"`
|
|
||||||
Height float64 `json:"height"`
|
|
||||||
} `json:"layout"`
|
|
||||||
} `json:"plotarea"`
|
} `json:"plotarea"`
|
||||||
ShowBlanksAs string `json:"show_blanks_as"`
|
ShowBlanksAs string `json:"show_blanks_as"`
|
||||||
ShowHiddenData bool `json:"show_hidden_data"`
|
ShowHiddenData bool `json:"show_hidden_data"`
|
||||||
|
@ -552,18 +544,13 @@ type formatChart struct {
|
||||||
|
|
||||||
// formatChartLegend directly maps the format settings of the chart legend.
|
// formatChartLegend directly maps the format settings of the chart legend.
|
||||||
type formatChartLegend struct {
|
type formatChartLegend struct {
|
||||||
None bool `json:"none"`
|
None bool `json:"none"`
|
||||||
DeleteSeries []int `json:"delete_series"`
|
DeleteSeries []int `json:"delete_series"`
|
||||||
Font formatFont `json:"font"`
|
Font formatFont `json:"font"`
|
||||||
Layout struct {
|
Layout formatLayout `json:"layout"`
|
||||||
X float64 `json:"x"`
|
Position string `json:"position"`
|
||||||
Y float64 `json:"y"`
|
ShowLegendEntry bool `json:"show_legend_entry"`
|
||||||
Width float64 `json:"width"`
|
ShowLegendKey bool `json:"show_legend_key"`
|
||||||
Height float64 `json:"height"`
|
|
||||||
} `json:"layout"`
|
|
||||||
Position string `json:"position"`
|
|
||||||
ShowLegendEntry bool `json:"show_legend_entry"`
|
|
||||||
ShowLegendKey bool `json:"show_legend_key"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatChartSeries directly maps the format settings of the chart series.
|
// formatChartSeries directly maps the format settings of the chart series.
|
||||||
|
@ -592,13 +579,16 @@ type formatChartSeries struct {
|
||||||
|
|
||||||
// formatChartTitle directly maps the format settings of the chart title.
|
// formatChartTitle directly maps the format settings of the chart title.
|
||||||
type formatChartTitle struct {
|
type formatChartTitle struct {
|
||||||
None bool `json:"none"`
|
None bool `json:"none"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Overlay bool `json:"overlay"`
|
Overlay bool `json:"overlay"`
|
||||||
Layout struct {
|
Layout formatLayout `json:"layout"`
|
||||||
X float64 `json:"x"`
|
}
|
||||||
Y float64 `json:"y"`
|
|
||||||
Width float64 `json:"width"`
|
// formatLayout directly maps the format settings of the element layout.
|
||||||
Height float64 `json:"height"`
|
type formatLayout struct {
|
||||||
} `json:"layout"`
|
X float64 `json:"x"`
|
||||||
|
Y float64 `json:"y"`
|
||||||
|
Width float64 `json:"width"`
|
||||||
|
Height float64 `json:"height"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue