|
@@ -13,12 +13,14 @@ var _ = []excelize.SheetViewOption{
|
|
|
excelize.ShowFormulas(false),
|
|
excelize.ShowFormulas(false),
|
|
|
excelize.ShowGridLines(true),
|
|
excelize.ShowGridLines(true),
|
|
|
excelize.ShowRowColHeaders(true),
|
|
excelize.ShowRowColHeaders(true),
|
|
|
|
|
+ excelize.TopLeftCell("B2"),
|
|
|
// SheetViewOptionPtr are also SheetViewOption
|
|
// SheetViewOptionPtr are also SheetViewOption
|
|
|
new(excelize.DefaultGridColor),
|
|
new(excelize.DefaultGridColor),
|
|
|
new(excelize.RightToLeft),
|
|
new(excelize.RightToLeft),
|
|
|
new(excelize.ShowFormulas),
|
|
new(excelize.ShowFormulas),
|
|
|
new(excelize.ShowGridLines),
|
|
new(excelize.ShowGridLines),
|
|
|
new(excelize.ShowRowColHeaders),
|
|
new(excelize.ShowRowColHeaders),
|
|
|
|
|
+ new(excelize.TopLeftCell),
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var _ = []excelize.SheetViewOptionPtr{
|
|
var _ = []excelize.SheetViewOptionPtr{
|
|
@@ -27,6 +29,7 @@ var _ = []excelize.SheetViewOptionPtr{
|
|
|
(*excelize.ShowFormulas)(nil),
|
|
(*excelize.ShowFormulas)(nil),
|
|
|
(*excelize.ShowGridLines)(nil),
|
|
(*excelize.ShowGridLines)(nil),
|
|
|
(*excelize.ShowRowColHeaders)(nil),
|
|
(*excelize.ShowRowColHeaders)(nil),
|
|
|
|
|
+ (*excelize.TopLeftCell)(nil),
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func ExampleFile_SetSheetViewOptions() {
|
|
func ExampleFile_SetSheetViewOptions() {
|
|
@@ -40,6 +43,7 @@ func ExampleFile_SetSheetViewOptions() {
|
|
|
excelize.ShowGridLines(true),
|
|
excelize.ShowGridLines(true),
|
|
|
excelize.ShowRowColHeaders(true),
|
|
excelize.ShowRowColHeaders(true),
|
|
|
excelize.ZoomScale(80),
|
|
excelize.ZoomScale(80),
|
|
|
|
|
+ excelize.TopLeftCell("C3"),
|
|
|
); err != nil {
|
|
); err != nil {
|
|
|
panic(err)
|
|
panic(err)
|
|
|
}
|
|
}
|
|
@@ -91,6 +95,7 @@ func ExampleFile_GetSheetViewOptions() {
|
|
|
showGridLines excelize.ShowGridLines
|
|
showGridLines excelize.ShowGridLines
|
|
|
showRowColHeaders excelize.ShowRowColHeaders
|
|
showRowColHeaders excelize.ShowRowColHeaders
|
|
|
zoomScale excelize.ZoomScale
|
|
zoomScale excelize.ZoomScale
|
|
|
|
|
+ topLeftCell excelize.TopLeftCell
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
if err := xl.GetSheetViewOptions(sheet, 0,
|
|
if err := xl.GetSheetViewOptions(sheet, 0,
|
|
@@ -100,6 +105,7 @@ func ExampleFile_GetSheetViewOptions() {
|
|
|
&showGridLines,
|
|
&showGridLines,
|
|
|
&showRowColHeaders,
|
|
&showRowColHeaders,
|
|
|
&zoomScale,
|
|
&zoomScale,
|
|
|
|
|
+ &topLeftCell,
|
|
|
); err != nil {
|
|
); err != nil {
|
|
|
panic(err)
|
|
panic(err)
|
|
|
}
|
|
}
|
|
@@ -111,6 +117,15 @@ func ExampleFile_GetSheetViewOptions() {
|
|
|
fmt.Println("- showGridLines:", showGridLines)
|
|
fmt.Println("- showGridLines:", showGridLines)
|
|
|
fmt.Println("- showRowColHeaders:", showRowColHeaders)
|
|
fmt.Println("- showRowColHeaders:", showRowColHeaders)
|
|
|
fmt.Println("- zoomScale:", zoomScale)
|
|
fmt.Println("- zoomScale:", zoomScale)
|
|
|
|
|
+ fmt.Println("- topLeftCell:", `"`+topLeftCell+`"`)
|
|
|
|
|
+
|
|
|
|
|
+ if err := xl.SetSheetViewOptions(sheet, 0, excelize.TopLeftCell("B2")); err != nil {
|
|
|
|
|
+ panic(err)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if err := xl.GetSheetViewOptions(sheet, 0, &topLeftCell); err != nil {
|
|
|
|
|
+ panic(err)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if err := xl.SetSheetViewOptions(sheet, 0, excelize.ShowGridLines(false)); err != nil {
|
|
if err := xl.SetSheetViewOptions(sheet, 0, excelize.ShowGridLines(false)); err != nil {
|
|
|
panic(err)
|
|
panic(err)
|
|
@@ -122,6 +137,7 @@ func ExampleFile_GetSheetViewOptions() {
|
|
|
|
|
|
|
|
fmt.Println("After change:")
|
|
fmt.Println("After change:")
|
|
|
fmt.Println("- showGridLines:", showGridLines)
|
|
fmt.Println("- showGridLines:", showGridLines)
|
|
|
|
|
+ fmt.Println("- topLeftCell:", topLeftCell)
|
|
|
|
|
|
|
|
// Output:
|
|
// Output:
|
|
|
// Default:
|
|
// Default:
|
|
@@ -131,8 +147,10 @@ func ExampleFile_GetSheetViewOptions() {
|
|
|
// - showGridLines: true
|
|
// - showGridLines: true
|
|
|
// - showRowColHeaders: true
|
|
// - showRowColHeaders: true
|
|
|
// - zoomScale: 0
|
|
// - zoomScale: 0
|
|
|
|
|
+ // - topLeftCell: ""
|
|
|
// After change:
|
|
// After change:
|
|
|
// - showGridLines: false
|
|
// - showGridLines: false
|
|
|
|
|
+ // - topLeftCell: B2
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestSheetViewOptionsErrors(t *testing.T) {
|
|
func TestSheetViewOptionsErrors(t *testing.T) {
|