summaryrefslogtreecommitdiff
path: root/sheet.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-01-16 21:51:23 +0800
committerxuri <xuri.me@gmail.com>2021-01-16 21:51:23 +0800
commit054bb9f0612ab7bd5836c3817d105a9b0c9e6059 (patch)
tree9a21dcdb9c91f3b2affa2ef8cd829d0433dd77f0 /sheet.go
parenta26675517e6326a7e3d3391f9de79d5efeb8bb90 (diff)
Support to adjust print scaling of the worksheet
Diffstat (limited to 'sheet.go')
-rw-r--r--sheet.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/sheet.go b/sheet.go
index 82c6a69..9f71de4 100644
--- a/sheet.go
+++ b/sheet.go
@@ -1144,6 +1144,10 @@ type (
FitToHeight int
// FitToWidth specified number of horizontal pages to fit on
FitToWidth int
+ // PageLayoutScale defines the print scaling. This attribute is restricted
+ // to values ranging from 10 (10%) to 400 (400%). This setting is
+ // overridden when fitToWidth and/or fitToHeight are in use.
+ PageLayoutScale uint
)
const (
@@ -1215,6 +1219,22 @@ func (p *FitToWidth) getPageLayout(ps *xlsxPageSetUp) {
*p = FitToWidth(ps.FitToWidth)
}
+// setPageLayout provides a method to set the scale for the worksheet.
+func (p PageLayoutScale) setPageLayout(ps *xlsxPageSetUp) {
+ if 10 <= uint(p) && uint(p) <= 400 {
+ ps.Scale = uint(p)
+ }
+}
+
+// getPageLayout provides a method to get the scale for the worksheet.
+func (p *PageLayoutScale) getPageLayout(ps *xlsxPageSetUp) {
+ if ps == nil || ps.Scale < 10 || ps.Scale > 400 {
+ *p = 100
+ return
+ }
+ *p = PageLayoutScale(ps.Scale)
+}
+
// SetPageLayout provides a function to sets worksheet page layout.
//
// Available options: