summaryrefslogtreecommitdiff
path: root/cell.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-02-21 00:21:45 +0800
committerxuri <xuri.me@gmail.com>2021-02-21 00:21:45 +0800
commit283339534741d3f0ff01c2ed2adc7c87445edf07 (patch)
treeddf0600943a9e234eb2c0e08326a0f671ba96a15 /cell.go
parent9154d500cf50621e15bf4a2bb9f6b5045d7b72d2 (diff)
This closes #787, avoid duplicate rich text string items, new formula fn: BIN2DEC, BIN2HEX, BIN2OCT, HEX2BIN, HEX2DEC, HEX2OCT, OCT2BIN, OCT2DEC, OCT2HEX
Diffstat (limited to 'cell.go')
-rw-r--r--cell.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/cell.go b/cell.go
index 4617b76..ae468e9 100644
--- a/cell.go
+++ b/cell.go
@@ -33,9 +33,9 @@ const (
)
// GetCellValue provides a function to get formatted value from cell by given
-// worksheet name and axis in XLSX file. If it is possible to apply a format
-// to the cell value, it will do so, if not then an error will be returned,
-// along with the raw value of the cell.
+// worksheet name and axis in spreadsheet file. If it is possible to apply a
+// format to the cell value, it will do so, if not then an error will be
+// returned, along with the raw value of the cell.
func (f *File) GetCellValue(sheet, axis string) (string, error) {
return f.getCellStringFunc(sheet, axis, func(x *xlsxWorksheet, c *xlsxC) (string, bool, error) {
val, err := c.getValueFrom(f, f.sharedStringsReader())
@@ -43,7 +43,7 @@ func (f *File) GetCellValue(sheet, axis string) (string, error) {
})
}
-// SetCellValue provides a function to set value of a cell. The specified
+// SetCellValue provides a function to set the value of a cell. The specified
// coordinates should not be in the first row of the table, a complex number
// can be set with string text. The following shows the supported data
// types:
@@ -645,6 +645,12 @@ func (f *File) SetCellRichText(sheet, cell string, runs []RichTextRun) error {
textRuns = append(textRuns, run)
}
si.R = textRuns
+ for idx, strItem := range sst.SI {
+ if reflect.DeepEqual(strItem, si) {
+ cellData.T, cellData.V = "s", strconv.Itoa(idx)
+ return err
+ }
+ }
sst.SI = append(sst.SI, si)
sst.Count++
sst.UniqueCount++