summaryrefslogtreecommitdiff
path: root/sheetpr.go
diff options
context:
space:
mode:
Diffstat (limited to 'sheetpr.go')
-rw-r--r--sheetpr.go26
1 files changed, 6 insertions, 20 deletions
diff --git a/sheetpr.go b/sheetpr.go
index 73a76a9..41ca082 100644
--- a/sheetpr.go
+++ b/sheetpr.go
@@ -163,26 +163,12 @@ func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error {
if ws.SheetFormatPr == nil {
ws.SheetFormatPr = &xlsxSheetFormatPr{DefaultRowHeight: defaultRowHeight}
}
- if opts.BaseColWidth != nil {
- ws.SheetFormatPr.BaseColWidth = *opts.BaseColWidth
- }
- if opts.DefaultColWidth != nil {
- ws.SheetFormatPr.DefaultColWidth = *opts.DefaultColWidth
- }
- if opts.DefaultRowHeight != nil {
- ws.SheetFormatPr.DefaultRowHeight = *opts.DefaultRowHeight
- }
- if opts.CustomHeight != nil {
- ws.SheetFormatPr.CustomHeight = *opts.CustomHeight
- }
- if opts.ZeroHeight != nil {
- ws.SheetFormatPr.ZeroHeight = *opts.ZeroHeight
- }
- if opts.ThickTop != nil {
- ws.SheetFormatPr.ThickTop = *opts.ThickTop
- }
- if opts.ThickBottom != nil {
- ws.SheetFormatPr.ThickBottom = *opts.ThickBottom
+ s := reflect.ValueOf(opts).Elem()
+ for i := 11; i < 18; i++ {
+ if !s.Field(i).IsNil() {
+ name := s.Type().Field(i).Name
+ reflect.ValueOf(ws.SheetFormatPr).Elem().FieldByName(name).Set(s.Field(i).Elem())
+ }
}
return err
}