forked from p30928647/excelize
Improvement compatibility with invalid first-page number attribute in the page layout
This commit is contained in:
parent
1ec0207fb5
commit
5ce3fe8cb8
12
sheet.go
12
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.
|
||||
|
|
|
@ -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"`
|
||||
|
|
Loading…
Reference in New Issue