diff --git a/sheet.go b/sheet.go index 05dc2cf1..7a1fff39 100644 --- a/sheet.go +++ b/sheet.go @@ -1202,7 +1202,7 @@ func (p *BlackAndWhite) getPageLayout(ps *xlsxPageSetUp) { // the worksheet. func (p FirstPageNumber) setPageLayout(ps *xlsxPageSetUp) { if 0 < int(p) { - ps.FirstPageNumber = int(p) + ps.FirstPageNumber = strconv.Itoa(int(p)) ps.UseFirstPageNumber = true } } @@ -1210,11 +1210,13 @@ func (p FirstPageNumber) setPageLayout(ps *xlsxPageSetUp) { // getPageLayout provides a method to get the first printed page number for // the worksheet. func (p *FirstPageNumber) getPageLayout(ps *xlsxPageSetUp) { - if ps == nil || ps.FirstPageNumber == 0 || !ps.UseFirstPageNumber { - *p = 1 - return + if ps != nil && ps.UseFirstPageNumber { + if number, _ := strconv.Atoi(ps.FirstPageNumber); number != 0 { + *p = FirstPageNumber(number) + return + } } - *p = FirstPageNumber(ps.FirstPageNumber) + *p = 1 } // setPageLayout provides a method to set the orientation for the worksheet. diff --git a/xmlWorksheet.go b/xmlWorksheet.go index d280bfdc..44995463 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -111,7 +111,7 @@ type xlsxPageSetUp struct { Copies int `xml:"copies,attr,omitempty"` Draft bool `xml:"draft,attr,omitempty"` Errors string `xml:"errors,attr,omitempty"` - FirstPageNumber int `xml:"firstPageNumber,attr,omitempty"` + FirstPageNumber string `xml:"firstPageNumber,attr,omitempty"` FitToHeight int `xml:"fitToHeight,attr,omitempty"` FitToWidth int `xml:"fitToWidth,attr,omitempty"` HorizontalDPI int `xml:"horizontalDpi,attr,omitempty"`