This closes #986, fix set data validation drop list failed in some cases

Update documentation for `GetCellValue` and simplify code
This commit is contained in:
xuri 2021-08-12 00:02:27 +08:00
parent c49e7aab30
commit 43a057b1ea
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
3 changed files with 4 additions and 4 deletions

View File

@ -34,8 +34,8 @@ const (
// GetCellValue provides a function to get formatted value from cell by given
// 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. All cells value will be
// same in a merged range.
// returned, along with the raw value of the cell. All cells' values will be
// the same in a merged range.
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())

View File

@ -154,7 +154,7 @@ func (dd *DataValidation) SetRange(f1, f2 float64, t DataValidationType, o DataV
//
func (dd *DataValidation) SetSqrefDropList(sqref string, isCurrentSheet bool) error {
if isCurrentSheet {
dd.Formula1 = sqref
dd.Formula1 = fmt.Sprintf("<formula1>%s</formula1>", sqref)
dd.Type = convDataValidationType(typeList)
return nil
}

View File

@ -622,7 +622,7 @@ func (f *File) drawingsWriter() {
}
// drawingResize calculate the height and width after resizing.
func (f *File) drawingResize(sheet string, cell string, width, height float64, formatSet *formatPicture) (w, h, c, r int, err error) {
func (f *File) drawingResize(sheet, cell string, width, height float64, formatSet *formatPicture) (w, h, c, r int, err error) {
var mergeCells []MergeCell
mergeCells, err = f.GetMergeCells(sheet)
if err != nil {