From 0e0237e62dcdbdd9ef5686d37171b1d5a61fac2b Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 7 May 2021 23:08:58 +0800 Subject: compatibility with non-standard page setup attributes --- sheet.go | 8 ++++---- xmlWorksheet.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sheet.go b/sheet.go index de46e90..7541f43 100644 --- a/sheet.go +++ b/sheet.go @@ -1204,8 +1204,8 @@ func (p *BlackAndWhite) getPageLayout(ps *xlsxPageSetUp) { // setPageLayout provides a method to set the first printed page number for // the worksheet. func (p FirstPageNumber) setPageLayout(ps *xlsxPageSetUp) { - if 0 < uint(p) { - ps.FirstPageNumber = uint(p) + if 0 < int(p) { + ps.FirstPageNumber = int(p) ps.UseFirstPageNumber = true } } @@ -1284,8 +1284,8 @@ func (p *FitToWidth) getPageLayout(ps *xlsxPageSetUp) { // 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) + if 10 <= int(p) && int(p) <= 400 { + ps.Scale = int(p) } } diff --git a/xmlWorksheet.go b/xmlWorksheet.go index edf5737..438e900 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -108,23 +108,23 @@ type xlsxPageSetUp struct { XMLName xml.Name `xml:"pageSetup"` BlackAndWhite bool `xml:"blackAndWhite,attr,omitempty"` CellComments string `xml:"cellComments,attr,omitempty"` - Copies uint `xml:"copies,attr,omitempty"` + Copies int `xml:"copies,attr,omitempty"` Draft bool `xml:"draft,attr,omitempty"` Errors string `xml:"errors,attr,omitempty"` - FirstPageNumber uint `xml:"firstPageNumber,attr,omitempty"` + FirstPageNumber int `xml:"firstPageNumber,attr,omitempty"` FitToHeight int `xml:"fitToHeight,attr,omitempty"` FitToWidth int `xml:"fitToWidth,attr,omitempty"` - HorizontalDPI uint `xml:"horizontalDpi,attr,omitempty"` + HorizontalDPI int `xml:"horizontalDpi,attr,omitempty"` RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"` Orientation string `xml:"orientation,attr,omitempty"` PageOrder string `xml:"pageOrder,attr,omitempty"` PaperHeight string `xml:"paperHeight,attr,omitempty"` PaperSize int `xml:"paperSize,attr,omitempty"` PaperWidth string `xml:"paperWidth,attr,omitempty"` - Scale uint `xml:"scale,attr,omitempty"` + Scale int `xml:"scale,attr,omitempty"` UseFirstPageNumber bool `xml:"useFirstPageNumber,attr,omitempty"` UsePrinterDefaults bool `xml:"usePrinterDefaults,attr,omitempty"` - VerticalDPI uint `xml:"verticalDpi,attr,omitempty"` + VerticalDPI int `xml:"verticalDpi,attr,omitempty"` } // xlsxPrintOptions directly maps the printOptions element in the namespace -- cgit v1.2.1