compatibility with non-standard page setup attributes

This commit is contained in:
xuri 2021-05-07 23:08:58 +08:00
parent 438fd4b3f9
commit 0e0237e62d
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
2 changed files with 9 additions and 9 deletions

View File

@ -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)
}
}

View File

@ -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