@ -485,7 +485,7 @@ func (f *File) SetCellDefault(sheet, cell, value string) error {
// setCellDefault prepares cell type and string type cell value by a given
// setCellDefault prepares cell type and string type cell value by a given
// string.
// string.
func setCellDefault ( value string ) ( t string , v string ) {
func setCellDefault ( value string ) ( t string , v string ) {
if ok , _ := isNumeric ( value ) ; ! ok {
if ok , _ , _ := isNumeric ( value ) ; ! ok {
t = "str"
t = "str"
}
}
v = value
v = value
@ -631,7 +631,7 @@ func (f *File) SetCellFormula(sheet, cell, formula string, opts ...FormulaOpts)
// setSharedFormula set shared formula for the cells.
// setSharedFormula set shared formula for the cells.
func ( ws * xlsxWorksheet ) setSharedFormula ( ref string ) error {
func ( ws * xlsxWorksheet ) setSharedFormula ( ref string ) error {
coordinates , err := area RefToCoordinates( ref )
coordinates , err := range RefToCoordinates( ref )
if err != nil {
if err != nil {
return err
return err
}
}
@ -1098,7 +1098,7 @@ func (f *File) setSheetCells(sheet, cell string, slice interface{}, dir adjustDi
return err
return err
}
}
// getCellInfo does common preparation for all SetCell* method s.
// getCellInfo does common preparation for all set cell value function s.
func ( f * File ) prepareCell ( ws * xlsxWorksheet , cell string ) ( * xlsxC , int , int , error ) {
func ( f * File ) prepareCell ( ws * xlsxWorksheet , cell string ) ( * xlsxC , int , int , error ) {
var err error
var err error
cell , err = f . mergeCellsParser ( ws , cell )
cell , err = f . mergeCellsParser ( ws , cell )
@ -1116,8 +1116,9 @@ func (f *File) prepareCell(ws *xlsxWorksheet, cell string) (*xlsxC, int, int, er
return & ws . SheetData . Row [ row - 1 ] . C [ col - 1 ] , col , row , err
return & ws . SheetData . Row [ row - 1 ] . C [ col - 1 ] , col , row , err
}
}
// getCellStringFunc does common value extraction workflow for all GetCell*
// getCellStringFunc does common value extraction workflow for all get cell
// methods. Passed function implements specific part of required logic.
// value function. Passed function implements specific part of required
// logic.
func ( f * File ) getCellStringFunc ( sheet , cell string , fn func ( x * xlsxWorksheet , c * xlsxC ) ( string , bool , error ) ) ( string , error ) {
func ( f * File ) getCellStringFunc ( sheet , cell string , fn func ( x * xlsxWorksheet , c * xlsxC ) ( string , bool , error ) ) ( string , error ) {
ws , err := f . workSheetReader ( sheet )
ws , err := f . workSheetReader ( sheet )
if err != nil {
if err != nil {
@ -1235,7 +1236,7 @@ func (f *File) mergeCellsParser(ws *xlsxWorksheet, cell string) (string, error)
i --
i --
continue
continue
}
}
ok , err := f . checkCellIn Area ( cell , ws . MergeCells . Cells [ i ] . Ref )
ok , err := f . checkCellIn RangeRef ( cell , ws . MergeCells . Cells [ i ] . Ref )
if err != nil {
if err != nil {
return cell , err
return cell , err
}
}
@ -1247,18 +1248,18 @@ func (f *File) mergeCellsParser(ws *xlsxWorksheet, cell string) (string, error)
return cell , nil
return cell , nil
}
}
// checkCellIn Area provides a function to determine if a given cell reference
// checkCellIn RangeRef provides a function to determine if a given cell reference
// in a range.
// in a range.
func ( f * File ) checkCellIn Area( cell , area string ) ( bool , error ) {
func ( f * File ) checkCellIn RangeRef( cell , reference string ) ( bool , error ) {
col , row , err := CellNameToCoordinates ( cell )
col , row , err := CellNameToCoordinates ( cell )
if err != nil {
if err != nil {
return false , err
return false , err
}
}
if rng := strings . Split ( area , ":" ) ; len ( rng ) != 2 {
if rng := strings . Split ( reference , ":" ) ; len ( rng ) != 2 {
return false , err
return false , err
}
}
coordinates , err := areaRefToCoordinates( area )
coordinates , err := rangeRefToCoordinates( reference )
if err != nil {
if err != nil {
return false , err
return false , err
}
}
@ -1333,7 +1334,7 @@ func parseSharedFormula(dCol, dRow int, orig []byte) (res string, start int) {
// R1C1-reference notation, are the same.
// R1C1-reference notation, are the same.
//
//
// Note that this function not validate ref tag to check the cell whether in
// Note that this function not validate ref tag to check the cell whether in
// allow area , and always return origin shared formula.
// allow range reference , and always return origin shared formula.
func getSharedFormula ( ws * xlsxWorksheet , si int , cell string ) string {
func getSharedFormula ( ws * xlsxWorksheet , si int , cell string ) string {
for _ , r := range ws . SheetData . Row {
for _ , r := range ws . SheetData . Row {
for _ , c := range r . C {
for _ , c := range r . C {