summaryrefslogtreecommitdiff
path: root/sheet_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'sheet_test.go')
-rw-r--r--sheet_test.go32
1 files changed, 21 insertions, 11 deletions
diff --git a/sheet_test.go b/sheet_test.go
index 701d824..d68327e 100644
--- a/sheet_test.go
+++ b/sheet_test.go
@@ -13,15 +13,11 @@ import (
func ExampleFile_SetPageLayout() {
f := NewFile()
-
if err := f.SetPageLayout(
"Sheet1",
+ BlackAndWhite(true),
+ FirstPageNumber(2),
PageLayoutOrientation(OrientationLandscape),
- ); err != nil {
- fmt.Println(err)
- }
- if err := f.SetPageLayout(
- "Sheet1",
PageLayoutPaperSize(10),
FitToHeight(2),
FitToWidth(2),
@@ -35,12 +31,20 @@ func ExampleFile_SetPageLayout() {
func ExampleFile_GetPageLayout() {
f := NewFile()
var (
- orientation PageLayoutOrientation
- paperSize PageLayoutPaperSize
- fitToHeight FitToHeight
- fitToWidth FitToWidth
- scale PageLayoutScale
+ blackAndWhite BlackAndWhite
+ firstPageNumber FirstPageNumber
+ orientation PageLayoutOrientation
+ paperSize PageLayoutPaperSize
+ fitToHeight FitToHeight
+ fitToWidth FitToWidth
+ scale PageLayoutScale
)
+ if err := f.GetPageLayout("Sheet1", &blackAndWhite); err != nil {
+ fmt.Println(err)
+ }
+ if err := f.GetPageLayout("Sheet1", &firstPageNumber); err != nil {
+ fmt.Println(err)
+ }
if err := f.GetPageLayout("Sheet1", &orientation); err != nil {
fmt.Println(err)
}
@@ -57,6 +61,8 @@ func ExampleFile_GetPageLayout() {
fmt.Println(err)
}
fmt.Println("Defaults:")
+ fmt.Printf("- print black and white: %t\n", blackAndWhite)
+ fmt.Printf("- page number for first printed page: %d\n", firstPageNumber)
fmt.Printf("- orientation: %q\n", orientation)
fmt.Printf("- paper size: %d\n", paperSize)
fmt.Printf("- fit to height: %d\n", fitToHeight)
@@ -64,6 +70,8 @@ func ExampleFile_GetPageLayout() {
fmt.Printf("- scale: %d\n", scale)
// Output:
// Defaults:
+ // - print black and white: false
+ // - page number for first printed page: 1
// - orientation: "portrait"
// - paper size: 1
// - fit to height: 1
@@ -103,6 +111,8 @@ func TestPageLayoutOption(t *testing.T) {
container PageLayoutOptionPtr
nonDefault PageLayoutOption
}{
+ {new(BlackAndWhite), BlackAndWhite(true)},
+ {new(FirstPageNumber), FirstPageNumber(2)},
{new(PageLayoutOrientation), PageLayoutOrientation(OrientationLandscape)},
{new(PageLayoutPaperSize), PageLayoutPaperSize(10)},
{new(FitToHeight), FitToHeight(2)},