summaryrefslogtreecommitdiff
path: root/cell.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-04-29 13:53:09 +0800
committerGitHub <noreply@github.com>2022-04-29 13:53:09 +0800
commit0f93bd23c97ac0f04fe8012bd4a262c851e44a82 (patch)
tree91df2abef72ff85e34f8001355d7af2c1068dc9e /cell.go
parentdf91b34a3f816a865ba6f9ea7707c668552df9d6 (diff)
This closes #1213, fix get incorrect rich text value caused by missing cell type checking
Diffstat (limited to 'cell.go')
-rw-r--r--cell.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cell.go b/cell.go
index b2818e7..3c44af4 100644
--- a/cell.go
+++ b/cell.go
@@ -764,7 +764,7 @@ func (f *File) GetCellRichText(sheet, cell string) (runs []RichTextRun, err erro
return
}
siIdx, err := strconv.Atoi(cellData.V)
- if nil != err {
+ if err != nil || cellData.T != "s" {
return
}
sst := f.sharedStringsReader()
@@ -776,7 +776,7 @@ func (f *File) GetCellRichText(sheet, cell string) (runs []RichTextRun, err erro
run := RichTextRun{
Text: v.T.Val,
}
- if nil != v.RPr {
+ if v.RPr != nil {
font := Font{Underline: "none"}
font.Bold = v.RPr.B != nil
font.Italic = v.RPr.I != nil
@@ -793,7 +793,7 @@ func (f *File) GetCellRichText(sheet, cell string) (runs []RichTextRun, err erro
font.Size = *v.RPr.Sz.Val
}
font.Strike = v.RPr.Strike != nil
- if nil != v.RPr.Color {
+ if v.RPr.Color != nil {
font.Color = strings.TrimPrefix(v.RPr.Color.RGB, "FF")
}
run.Font = &font