From 6962061200e2198acc39392c35344d1826268f34 Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 8 Jul 2019 20:17:47 +0800 Subject: add comments for SheetView parameters --- sheetview.go | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'sheetview.go') diff --git a/sheetview.go b/sheetview.go index 8ffc9bc..91260fe 100644 --- a/sheetview.go +++ b/sheetview.go @@ -23,22 +23,36 @@ type SheetViewOptionPtr interface { } type ( - // DefaultGridColor is a SheetViewOption. + // DefaultGridColor specified a flag indicating that the consuming + // application should use the default grid lines color (system dependent). + // Overrides any color specified in colorId. DefaultGridColor bool - // RightToLeft is a SheetViewOption. + // RightToLeft specified a flag indicating whether the sheet is in 'right to + // left' display mode. When in this mode, Column A is on the far right, + // Column B ;is one column left of Column A, and so on. Also, information in + // cells is displayed in the Right to Left format. RightToLeft bool - // ShowFormulas is a SheetViewOption. + // ShowFormulas specified a flag indicating whether this sheet should display + // formulas. ShowFormulas bool - // ShowGridLines is a SheetViewOption. + // ShowGridLines specified a flag indicating whether this sheet should + // display gridlines. ShowGridLines bool - // ShowRowColHeaders is a SheetViewOption. + // ShowRowColHeaders specified a flag indicating whether the sheet should + // display row and column headings. ShowRowColHeaders bool - // ZoomScale is a SheetViewOption. + // ZoomScale specified a window zoom magnification for current view + // representing percent values. This attribute is restricted to values + // ranging from 10 to 400. Horizontal & Vertical scale together. ZoomScale float64 - // TopLeftCell is a SheetViewOption. + // TopLeftCell specified a location of the top left visible cell Location of + // the top left visible cell in the bottom right pane (when in Left-to-Right + // mode). TopLeftCell string /* TODO - // ShowWhiteSpace is a SheetViewOption. + // ShowWhiteSpace specified flag indicating whether page layout view shall + // display margins. False means do not display left, right, top (header), and + // bottom (footer) margins (even when there is data in the header or footer). ShowWhiteSpace bool // ShowZeros is a SheetViewOption. ShowZeros bool @@ -98,7 +112,7 @@ func (o *ShowRowColHeaders) getSheetViewOption(view *xlsxSheetView) { } func (o ZoomScale) setSheetViewOption(view *xlsxSheetView) { - //This attribute is restricted to values ranging from 10 to 400. + // This attribute is restricted to values ranging from 10 to 400. if float64(o) >= 10 && float64(o) <= 400 { view.ZoomScale = float64(o) } @@ -135,6 +149,8 @@ func (f *File) getSheetView(sheetName string, viewIndex int) (*xlsxSheetView, er // ShowFormulas(bool) // ShowGridLines(bool) // ShowRowColHeaders(bool) +// ZoomScale(float64) +// TopLeftCell(string) // Example: // err = f.SetSheetViewOptions("Sheet1", -1, ShowGridLines(false)) func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOption) error { @@ -158,6 +174,8 @@ func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetView // ShowFormulas(bool) // ShowGridLines(bool) // ShowRowColHeaders(bool) +// ZoomScale(float64) +// TopLeftCell(string) // Example: // var showGridLines excelize.ShowGridLines // err = f.GetSheetViewOptions("Sheet1", -1, &showGridLines) -- cgit v1.2.1 From 58a79b41720974009aacf57209a7d5afdd75a7fd Mon Sep 17 00:00:00 2001 From: zhaov <779137069@qq.com> Date: Tue, 6 Aug 2019 09:50:45 +0800 Subject: Update comments --- sheetview.go | 67 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 28 deletions(-) (limited to 'sheetview.go') diff --git a/sheetview.go b/sheetview.go index 91260fe..9712d85 100644 --- a/sheetview.go +++ b/sheetview.go @@ -11,48 +11,51 @@ package excelize import "fmt" -// SheetViewOption is an option of a view of a worksheet. See SetSheetViewOptions(). +// SheetViewOption is an option of a view of a worksheet. See +// SetSheetViewOptions(). type SheetViewOption interface { setSheetViewOption(view *xlsxSheetView) } -// SheetViewOptionPtr is a writable SheetViewOption. See GetSheetViewOptions(). +// SheetViewOptionPtr is a writable SheetViewOption. See +// GetSheetViewOptions(). type SheetViewOptionPtr interface { SheetViewOption getSheetViewOption(view *xlsxSheetView) } type ( - // DefaultGridColor specified a flag indicating that the consuming - // application should use the default grid lines color (system dependent). - // Overrides any color specified in colorId. + // DefaultGridColor is a SheetViewOption. It specifies a flag indicating that + // the consuming application should use the default grid lines color (system + // dependent). Overrides any color specified in colorId. DefaultGridColor bool - // RightToLeft specified a flag indicating whether the sheet is in 'right to - // left' display mode. When in this mode, Column A is on the far right, - // Column B ;is one column left of Column A, and so on. Also, information in - // cells is displayed in the Right to Left format. + // RightToLeft is a SheetViewOption. It specifies a flag indicating whether + // the sheet is in 'right to left' display mode. When in this mode, Column A + // is on the far right, Column B ;is one column left of Column A, and so on. + // Also, information in cells is displayed in the Right to Left format. RightToLeft bool - // ShowFormulas specified a flag indicating whether this sheet should display - // formulas. + // ShowFormulas is a SheetViewOption. It specifies a flag indicating whether + // this sheet should display formulas. ShowFormulas bool - // ShowGridLines specified a flag indicating whether this sheet should - // display gridlines. + // ShowGridLines is a SheetViewOption. It specifies a flag indicating whether + // this sheet should display gridlines. ShowGridLines bool - // ShowRowColHeaders specified a flag indicating whether the sheet should - // display row and column headings. + // ShowRowColHeaders is a SheetViewOption. It specifies a flag indicating + // whether the sheet should display row and column headings. ShowRowColHeaders bool - // ZoomScale specified a window zoom magnification for current view - // representing percent values. This attribute is restricted to values - // ranging from 10 to 400. Horizontal & Vertical scale together. + // ZoomScale is a SheetViewOption. It specifies a window zoom magnification + // for current view representing percent values. This attribute is restricted + // to values ranging from 10 to 400. Horizontal & Vertical scale together. ZoomScale float64 - // TopLeftCell specified a location of the top left visible cell Location of - // the top left visible cell in the bottom right pane (when in Left-to-Right - // mode). + // TopLeftCell is a SheetViewOption. It specifies a location of the top left + // visible cell Location of the top left visible cell in the bottom right + // pane (when in Left-to-Right mode). TopLeftCell string /* TODO - // ShowWhiteSpace specified flag indicating whether page layout view shall - // display margins. False means do not display left, right, top (header), and - // bottom (footer) margins (even when there is data in the header or footer). + // ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating + // whether page layout view shall display margins. False means do not display + // left, right, top (header), and bottom (footer) margins (even when there is + // data in the header or footer). ShowWhiteSpace bool // ShowZeros is a SheetViewOption. ShowZeros bool @@ -140,10 +143,11 @@ func (f *File) getSheetView(sheetName string, viewIndex int) (*xlsxSheetView, er return &(xlsx.SheetViews.SheetView[viewIndex]), err } -// SetSheetViewOptions sets sheet view options. -// The viewIndex may be negative and if so is counted backward (-1 is the last view). +// SetSheetViewOptions sets sheet view options. The viewIndex may be negative +// and if so is counted backward (-1 is the last view). // // Available options: +// // DefaultGridColor(bool) // RightToLeft(bool) // ShowFormulas(bool) @@ -151,8 +155,11 @@ func (f *File) getSheetView(sheetName string, viewIndex int) (*xlsxSheetView, er // ShowRowColHeaders(bool) // ZoomScale(float64) // TopLeftCell(string) +// // Example: +// // err = f.SetSheetViewOptions("Sheet1", -1, ShowGridLines(false)) +// func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOption) error { view, err := f.getSheetView(name, viewIndex) if err != nil { @@ -165,10 +172,11 @@ func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetView return nil } -// GetSheetViewOptions gets the value of sheet view options. -// The viewIndex may be negative and if so is counted backward (-1 is the last view). +// GetSheetViewOptions gets the value of sheet view options. The viewIndex may +// be negative and if so is counted backward (-1 is the last view). // // Available options: +// // DefaultGridColor(bool) // RightToLeft(bool) // ShowFormulas(bool) @@ -176,9 +184,12 @@ func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetView // ShowRowColHeaders(bool) // ZoomScale(float64) // TopLeftCell(string) +// // Example: +// // var showGridLines excelize.ShowGridLines // err = f.GetSheetViewOptions("Sheet1", -1, &showGridLines) +// func (f *File) GetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOptionPtr) error { view, err := f.getSheetView(name, viewIndex) if err != nil { -- cgit v1.2.1 From 9c70d0ac868f66badf2663cc7b4b3c46d5411131 Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 11 Aug 2019 00:36:14 +0800 Subject: Documentation updated, Go 1.10+ required --- sheetview.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sheetview.go') diff --git a/sheetview.go b/sheetview.go index 9712d85..09f5789 100644 --- a/sheetview.go +++ b/sheetview.go @@ -5,7 +5,7 @@ // 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. +// charts of XLSX. This library needs Go version 1.10 or later. package excelize -- cgit v1.2.1 From babfeb6b57ad3e63f68f5e031869efc54c9cfe0b Mon Sep 17 00:00:00 2001 From: jaby Date: Mon, 30 Sep 2019 14:37:52 +0200 Subject: Add missing ShowZeros SheetViewOption implementation --- sheetview.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sheetview.go') diff --git a/sheetview.go b/sheetview.go index 09f5789..8a5091f 100644 --- a/sheetview.go +++ b/sheetview.go @@ -51,14 +51,18 @@ type ( // visible cell Location of the top left visible cell in the bottom right // pane (when in Left-to-Right mode). TopLeftCell string + // ShowZeros is a SheetViewOption. It specifies a flag indicating + // whether to "show a zero in cells that have zero value". + // When using a formula to reference another cell which is empty, the referenced value becomes 0 + // when the flag is true. (Default setting is true.) + ShowZeros bool + /* TODO // ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating // whether page layout view shall display margins. False means do not display // left, right, top (header), and bottom (footer) margins (even when there is // data in the header or footer). ShowWhiteSpace bool - // ShowZeros is a SheetViewOption. - ShowZeros bool // WindowProtection is a SheetViewOption. WindowProtection bool */ @@ -106,6 +110,14 @@ func (o *ShowGridLines) getSheetViewOption(view *xlsxSheetView) { *o = ShowGridLines(defaultTrue(view.ShowGridLines)) // Excel default: true } +func (o ShowZeros) setSheetViewOption(view *xlsxSheetView) { + view.ShowZeros = boolPtr(bool(o)) +} + +func (o *ShowZeros) getSheetViewOption(view *xlsxSheetView) { + *o = ShowZeros(defaultTrue(view.ShowZeros)) // Excel default: true +} + func (o ShowRowColHeaders) setSheetViewOption(view *xlsxSheetView) { view.ShowRowColHeaders = boolPtr(bool(o)) } -- cgit v1.2.1 From 09485b3f9f0aefc58d51462aed65c2416205c591 Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 29 Dec 2019 16:02:31 +0800 Subject: Improve code coverage unit tests --- sheetview.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sheetview.go') diff --git a/sheetview.go b/sheetview.go index 8a5091f..fa3cfdf 100644 --- a/sheetview.go +++ b/sheetview.go @@ -1,4 +1,4 @@ -// Copyright 2016 - 2019 The excelize Authors. All rights reserved. Use of +// Copyright 2016 - 2020 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. // -- cgit v1.2.1