Skip to content

Commit

Permalink
spreadsheet: recompute sheet dimensions prior to save
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaliance committed Sep 27, 2017
1 parent c5be453 commit 551e748
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Binary file modified spreadsheet/testdata/simple-1.xlsx
Binary file not shown.
Binary file modified spreadsheet/testdata/simple-2.xlsx
Binary file not shown.
3 changes: 3 additions & 0 deletions spreadsheet/workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func (wb *Workbook) Save(w io.Writer) error {
}
}
for i, sheet := range wb.xws {
// recalculate sheet dimensions
sheet.Dimension.RefAttr = Sheet{wb, nil, sheet}.Extents()

fn := gooxml.AbsoluteFilename(dt, gooxml.WorksheetType, i+1)
zippkg.MarshalXML(z, fn, sheet)
zippkg.MarshalXML(z, zippkg.RelationsPathFor(fn), wb.xwsRels[i].X())
Expand Down

0 comments on commit 551e748

Please sign in to comment.