diff options
author | xuri <xuri.me@gmail.com> | 2018-05-07 15:50:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 15:50:11 +0800 |
commit | 761d47f45a06cb18ef346ec2955f4ca23cf705ff (patch) | |
tree | 5f444833129de73850e7192171a919575e97a4bc /sheetview_test.go | |
parent | 3746ba6a50be963673e0972596f37310ccaa9662 (diff) | |
parent | 52eb0ececfe8f035a35a8a20892a57ca9d2f65a5 (diff) |
Merge pull request #211 from OloloevReal/master
Added ZoomScale SheetViewOption
Diffstat (limited to 'sheetview_test.go')
-rw-r--r-- | sheetview_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sheetview_test.go b/sheetview_test.go index 2061012..c580906 100644 --- a/sheetview_test.go +++ b/sheetview_test.go @@ -39,10 +39,45 @@ func ExampleFile_SetSheetViewOptions() { excelize.ShowFormulas(true), excelize.ShowGridLines(true), excelize.ShowRowColHeaders(true), + excelize.ZoomScale(80), ); err != nil { panic(err) } + + var zoomScale excelize.ZoomScale + fmt.Println("Default:") + fmt.Println("- zoomScale: 80") + + if err := xl.SetSheetViewOptions(sheet, 0, excelize.ZoomScale(500)); err != nil { + panic(err) + } + + if err := xl.GetSheetViewOptions(sheet, 0, &zoomScale); err != nil { + panic(err) + } + + fmt.Println("Used out of range value:") + fmt.Println("- zoomScale:", zoomScale) + + if err := xl.SetSheetViewOptions(sheet, 0, excelize.ZoomScale(123)); err != nil { + panic(err) + } + + if err := xl.GetSheetViewOptions(sheet, 0, &zoomScale); err != nil { + panic(err) + } + + fmt.Println("Used correct value:") + fmt.Println("- zoomScale:", zoomScale) + // Output: + // Default: + // - zoomScale: 80 + // Used out of range value: + // - zoomScale: 80 + // Used correct value: + // - zoomScale: 123 + } func ExampleFile_GetSheetViewOptions() { @@ -55,6 +90,7 @@ func ExampleFile_GetSheetViewOptions() { showFormulas excelize.ShowFormulas showGridLines excelize.ShowGridLines showRowColHeaders excelize.ShowRowColHeaders + zoomScale excelize.ZoomScale ) if err := xl.GetSheetViewOptions(sheet, 0, @@ -63,6 +99,7 @@ func ExampleFile_GetSheetViewOptions() { &showFormulas, &showGridLines, &showRowColHeaders, + &zoomScale, ); err != nil { panic(err) } @@ -73,6 +110,7 @@ func ExampleFile_GetSheetViewOptions() { fmt.Println("- showFormulas:", showFormulas) fmt.Println("- showGridLines:", showGridLines) fmt.Println("- showRowColHeaders:", showRowColHeaders) + fmt.Println("- zoomScale:", zoomScale) if err := xl.SetSheetViewOptions(sheet, 0, excelize.ShowGridLines(false)); err != nil { panic(err) @@ -92,6 +130,7 @@ func ExampleFile_GetSheetViewOptions() { // - showFormulas: false // - showGridLines: true // - showRowColHeaders: true + // - zoomScale: 0 // After change: // - showGridLines: false } |