Skip to content

Commit

Permalink
fix sharedStringsValue.Reset() (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
alicebob committed Apr 21, 2021
1 parent 39d7714 commit 461e4ef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shared_strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (sv *sharedStringsValue) String() string {
// Reset zeroes data inside struct.
func (sv *sharedStringsValue) Reset() {
sv.Text = ""
sv.RichText = sv.RichText[0:]
sv.RichText = sv.RichText[:0]
}

// Sentinel error to indicate that no shared strings file can be found
Expand Down
8 changes: 8 additions & 0 deletions shared_strings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ func TestLoadingSharedStrings(t *testing.T) {
require.Equal(t, []string{"rec_id", "culture", "sex"}, actual.sharedStrings)
})
}

t.Run("bold", func(t *testing.T) {
actual, err := OpenFile("./test/test-bold.xlsx")
require.NoError(t, err)
defer actual.Close()

require.Equal(t, []string{"Contact ID", "Phone Number"}, actual.sharedStrings)
})
}
Binary file added test/test-bold.xlsx
Binary file not shown.

0 comments on commit 461e4ef

Please sign in to comment.