Skip to content

Commit

Permalink
Improve compatibility, fix workbook's rels ID calc error
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Dec 22, 2019
1 parent ae2865d commit 4e4a5b9
Show file tree
Hide file tree
Showing 17 changed files with 213 additions and 172 deletions.
2 changes: 1 addition & 1 deletion adjust.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (f *File) adjustHelper(sheet string, dir adjustDirection, num, offset int)
return err
}
checkSheet(xlsx)
checkRow(xlsx)
_ = checkRow(xlsx)

if xlsx.MergeCells != nil && len(xlsx.MergeCells.Cells) == 0 {
xlsx.MergeCells = nil
Expand Down
2 changes: 1 addition & 1 deletion cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (f *File) SetCellHyperLink(sheet, axis, link, linkType string) error {
linkData = xlsxHyperlink{
Ref: axis,
}
sheetPath, _ := f.sheetMap[trimSheetName(sheet)]
sheetPath := f.sheetMap[trimSheetName(sheet)]
sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetPath, "xl/worksheets/") + ".rels"
rID := f.addRels(sheetRels, SourceRelationshipHyperLink, link, linkType)
linkData.RID = "rId" + strconv.Itoa(rID)
Expand Down
2 changes: 0 additions & 2 deletions cellmerged.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ func (f *File) UnmergeCell(sheet string, hcell, vcell string) error {
if rect1[3] < rect1[1] {
rect1[1], rect1[3] = rect1[3], rect1[1]
}
hcell, _ = CoordinatesToCellName(rect1[0], rect1[1])
vcell, _ = CoordinatesToCellName(rect1[2], rect1[3])

// return nil since no MergeCells in the sheet
if xlsx.MergeCells == nil {
Expand Down
Loading

0 comments on commit 4e4a5b9

Please sign in to comment.