forked from p30928647/excelize
commit
d8df51098f
67
sheetview.go
67
sheetview.go
|
@ -11,48 +11,51 @@ package excelize
|
||||||
|
|
||||||
import "fmt"
|
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 {
|
type SheetViewOption interface {
|
||||||
setSheetViewOption(view *xlsxSheetView)
|
setSheetViewOption(view *xlsxSheetView)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SheetViewOptionPtr is a writable SheetViewOption. See GetSheetViewOptions().
|
// SheetViewOptionPtr is a writable SheetViewOption. See
|
||||||
|
// GetSheetViewOptions().
|
||||||
type SheetViewOptionPtr interface {
|
type SheetViewOptionPtr interface {
|
||||||
SheetViewOption
|
SheetViewOption
|
||||||
getSheetViewOption(view *xlsxSheetView)
|
getSheetViewOption(view *xlsxSheetView)
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// DefaultGridColor specified a flag indicating that the consuming
|
// DefaultGridColor is a SheetViewOption. It specifies a flag indicating that
|
||||||
// application should use the default grid lines color (system dependent).
|
// the consuming application should use the default grid lines color (system
|
||||||
// Overrides any color specified in colorId.
|
// dependent). Overrides any color specified in colorId.
|
||||||
DefaultGridColor bool
|
DefaultGridColor bool
|
||||||
// RightToLeft specified a flag indicating whether the sheet is in 'right to
|
// RightToLeft is a SheetViewOption. It specifies a flag indicating whether
|
||||||
// left' display mode. When in this mode, Column A is on the far right,
|
// the sheet is in 'right to left' display mode. When in this mode, Column A
|
||||||
// Column B ;is one column left of Column A, and so on. Also, information in
|
// is on the far right, Column B ;is one column left of Column A, and so on.
|
||||||
// cells is displayed in the Right to Left format.
|
// Also, information in cells is displayed in the Right to Left format.
|
||||||
RightToLeft bool
|
RightToLeft bool
|
||||||
// ShowFormulas specified a flag indicating whether this sheet should display
|
// ShowFormulas is a SheetViewOption. It specifies a flag indicating whether
|
||||||
// formulas.
|
// this sheet should display formulas.
|
||||||
ShowFormulas bool
|
ShowFormulas bool
|
||||||
// ShowGridLines specified a flag indicating whether this sheet should
|
// ShowGridLines is a SheetViewOption. It specifies a flag indicating whether
|
||||||
// display gridlines.
|
// this sheet should display gridlines.
|
||||||
ShowGridLines bool
|
ShowGridLines bool
|
||||||
// ShowRowColHeaders specified a flag indicating whether the sheet should
|
// ShowRowColHeaders is a SheetViewOption. It specifies a flag indicating
|
||||||
// display row and column headings.
|
// whether the sheet should display row and column headings.
|
||||||
ShowRowColHeaders bool
|
ShowRowColHeaders bool
|
||||||
// ZoomScale specified a window zoom magnification for current view
|
// ZoomScale is a SheetViewOption. It specifies a window zoom magnification
|
||||||
// representing percent values. This attribute is restricted to values
|
// for current view representing percent values. This attribute is restricted
|
||||||
// ranging from 10 to 400. Horizontal & Vertical scale together.
|
// to values ranging from 10 to 400. Horizontal & Vertical scale together.
|
||||||
ZoomScale float64
|
ZoomScale float64
|
||||||
// TopLeftCell specified a location of the top left visible cell Location of
|
// TopLeftCell is a SheetViewOption. It specifies a location of the top left
|
||||||
// the top left visible cell in the bottom right pane (when in Left-to-Right
|
// visible cell Location of the top left visible cell in the bottom right
|
||||||
// mode).
|
// pane (when in Left-to-Right mode).
|
||||||
TopLeftCell string
|
TopLeftCell string
|
||||||
/* TODO
|
/* TODO
|
||||||
// ShowWhiteSpace specified flag indicating whether page layout view shall
|
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
|
||||||
// display margins. False means do not display left, right, top (header), and
|
// whether page layout view shall display margins. False means do not display
|
||||||
// bottom (footer) margins (even when there is data in the header or footer).
|
// left, right, top (header), and bottom (footer) margins (even when there is
|
||||||
|
// data in the header or footer).
|
||||||
ShowWhiteSpace bool
|
ShowWhiteSpace bool
|
||||||
// ShowZeros is a SheetViewOption.
|
// ShowZeros is a SheetViewOption.
|
||||||
ShowZeros bool
|
ShowZeros bool
|
||||||
|
@ -140,10 +143,11 @@ func (f *File) getSheetView(sheetName string, viewIndex int) (*xlsxSheetView, er
|
||||||
return &(xlsx.SheetViews.SheetView[viewIndex]), err
|
return &(xlsx.SheetViews.SheetView[viewIndex]), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSheetViewOptions sets sheet view options.
|
// SetSheetViewOptions sets sheet view options. The viewIndex may be negative
|
||||||
// The viewIndex may be negative and if so is counted backward (-1 is the last view).
|
// and if so is counted backward (-1 is the last view).
|
||||||
//
|
//
|
||||||
// Available options:
|
// Available options:
|
||||||
|
//
|
||||||
// DefaultGridColor(bool)
|
// DefaultGridColor(bool)
|
||||||
// RightToLeft(bool)
|
// RightToLeft(bool)
|
||||||
// ShowFormulas(bool)
|
// ShowFormulas(bool)
|
||||||
|
@ -151,8 +155,11 @@ func (f *File) getSheetView(sheetName string, viewIndex int) (*xlsxSheetView, er
|
||||||
// ShowRowColHeaders(bool)
|
// ShowRowColHeaders(bool)
|
||||||
// ZoomScale(float64)
|
// ZoomScale(float64)
|
||||||
// TopLeftCell(string)
|
// TopLeftCell(string)
|
||||||
|
//
|
||||||
// Example:
|
// Example:
|
||||||
|
//
|
||||||
// err = f.SetSheetViewOptions("Sheet1", -1, ShowGridLines(false))
|
// err = f.SetSheetViewOptions("Sheet1", -1, ShowGridLines(false))
|
||||||
|
//
|
||||||
func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOption) error {
|
func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOption) error {
|
||||||
view, err := f.getSheetView(name, viewIndex)
|
view, err := f.getSheetView(name, viewIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -165,10 +172,11 @@ func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetView
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSheetViewOptions gets the value of sheet view options.
|
// GetSheetViewOptions gets the value of sheet view options. The viewIndex may
|
||||||
// The viewIndex may be negative and if so is counted backward (-1 is the last view).
|
// be negative and if so is counted backward (-1 is the last view).
|
||||||
//
|
//
|
||||||
// Available options:
|
// Available options:
|
||||||
|
//
|
||||||
// DefaultGridColor(bool)
|
// DefaultGridColor(bool)
|
||||||
// RightToLeft(bool)
|
// RightToLeft(bool)
|
||||||
// ShowFormulas(bool)
|
// ShowFormulas(bool)
|
||||||
|
@ -176,9 +184,12 @@ func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetView
|
||||||
// ShowRowColHeaders(bool)
|
// ShowRowColHeaders(bool)
|
||||||
// ZoomScale(float64)
|
// ZoomScale(float64)
|
||||||
// TopLeftCell(string)
|
// TopLeftCell(string)
|
||||||
|
//
|
||||||
// Example:
|
// Example:
|
||||||
|
//
|
||||||
// var showGridLines excelize.ShowGridLines
|
// var showGridLines excelize.ShowGridLines
|
||||||
// err = f.GetSheetViewOptions("Sheet1", -1, &showGridLines)
|
// err = f.GetSheetViewOptions("Sheet1", -1, &showGridLines)
|
||||||
|
//
|
||||||
func (f *File) GetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOptionPtr) error {
|
func (f *File) GetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOptionPtr) error {
|
||||||
view, err := f.getSheetView(name, viewIndex)
|
view, err := f.getSheetView(name, viewIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue