소스 검색

SheetViewOptionPtr: document that it is a superset of SheetViewOption

Document in type system (not just in text for humans) that
all SheetViewOptionPtr are also SheetViewOption (well, if not nil).
This improves documentation visible with godoc but this simple change
also allows more flexibility to manipulate SheetViewOption programatically
such as saving and restoring values:

	var opt excelize.ShowFormulas
	opt = new(excelize.ShowFormulas)
	_ = xl.GetSheetViewOptions(sheet, -1, opt)
	_ = xl.SetSheetViewOptions(sheet, -1, opt)
Olivier Mengué 8 년 전
부모
커밋
d2fb0197ab
2개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      sheetview.go
  2. 6 0
      sheetview_test.go

+ 1 - 0
sheetview.go

@@ -9,6 +9,7 @@ type SheetViewOption interface {
 
 // SheetViewOptionPtr is a writable SheetViewOption. See GetSheetViewOptions().
 type SheetViewOptionPtr interface {
+	SheetViewOption
 	getSheetViewOption(view *xlsxSheetView)
 }
 

+ 6 - 0
sheetview_test.go

@@ -13,6 +13,12 @@ var _ = []excelize.SheetViewOption{
 	excelize.ShowFormulas(false),
 	excelize.ShowGridLines(true),
 	excelize.ShowRowColHeaders(true),
+	// SheetViewOptionPtr are also SheetViewOption
+	new(excelize.DefaultGridColor),
+	new(excelize.RightToLeft),
+	new(excelize.ShowFormulas),
+	new(excelize.ShowGridLines),
+	new(excelize.ShowRowColHeaders),
 }
 
 var _ = []excelize.SheetViewOptionPtr{