|
|
@@ -162,10 +162,10 @@ func intOnlyMapF(rune rune) rune {
|
|
|
return -1
|
|
|
}
|
|
|
|
|
|
-// getCoordsFromCellIDString returns the zero based cartesian
|
|
|
+// GetCoordsFromCellIDString returns the zero based cartesian
|
|
|
// coordinates from a cell name in Excel format, e.g. the cellIDString
|
|
|
// "A1" returns 0, 0 and the "B3" return 1, 2.
|
|
|
-func getCoordsFromCellIDString(cellIDString string) (x, y int, error error) {
|
|
|
+func GetCoordsFromCellIDString(cellIDString string) (x, y int, error error) {
|
|
|
var letterPart string = strings.Map(letterOnlyMapF, cellIDString)
|
|
|
y, error = strconv.Atoi(strings.Map(intOnlyMapF, cellIDString))
|
|
|
if error != nil {
|
|
|
@@ -176,9 +176,9 @@ func getCoordsFromCellIDString(cellIDString string) (x, y int, error error) {
|
|
|
return x, y, error
|
|
|
}
|
|
|
|
|
|
-// getCellIDStringFromCoords returns the Excel format cell name that
|
|
|
+// GetCellIDStringFromCoords returns the Excel format cell name that
|
|
|
// represents a pair of zero based cartesian coordinates.
|
|
|
-func getCellIDStringFromCoords(x, y int) string {
|
|
|
+func GetCellIDStringFromCoords(x, y int) string {
|
|
|
letterPart := numericToLetters(x)
|
|
|
numericPart := y + 1
|
|
|
return fmt.Sprintf("%s%d", letterPart, numericPart)
|
|
|
@@ -191,7 +191,7 @@ func getCellIDStringFromCoords(x, y int) string {
|
|
|
func getMaxMinFromDimensionRef(ref string) (minx, miny, maxx, maxy int, err error) {
|
|
|
var parts []string
|
|
|
parts = strings.Split(ref, ":")
|
|
|
- minx, miny, err = getCoordsFromCellIDString(parts[0])
|
|
|
+ minx, miny, err = GetCoordsFromCellIDString(parts[0])
|
|
|
if err != nil {
|
|
|
return -1, -1, -1, -1, err
|
|
|
}
|
|
|
@@ -199,7 +199,7 @@ func getMaxMinFromDimensionRef(ref string) (minx, miny, maxx, maxy int, err erro
|
|
|
maxx, maxy = minx, miny
|
|
|
return
|
|
|
}
|
|
|
- maxx, maxy, err = getCoordsFromCellIDString(parts[1])
|
|
|
+ maxx, maxy, err = GetCoordsFromCellIDString(parts[1])
|
|
|
if err != nil {
|
|
|
return -1, -1, -1, -1, err
|
|
|
}
|
|
|
@@ -220,7 +220,7 @@ func calculateMaxMinFromWorksheet(worksheet *xlsxWorksheet) (minx, miny, maxx, m
|
|
|
maxx = 0
|
|
|
for _, row := range worksheet.SheetData.Row {
|
|
|
for _, cell := range row.C {
|
|
|
- x, y, err = getCoordsFromCellIDString(cell.R)
|
|
|
+ x, y, err = GetCoordsFromCellIDString(cell.R)
|
|
|
if err != nil {
|
|
|
return -1, -1, -1, -1, err
|
|
|
}
|
|
|
@@ -285,7 +285,7 @@ func makeRowFromRaw(rawrow xlsxRow, sheet *Sheet) *Row {
|
|
|
|
|
|
for _, rawcell := range rawrow.C {
|
|
|
if rawcell.R != "" {
|
|
|
- x, _, error := getCoordsFromCellIDString(rawcell.R)
|
|
|
+ x, _, error := GetCoordsFromCellIDString(rawcell.R)
|
|
|
if error != nil {
|
|
|
panic(fmt.Sprintf("Invalid Cell Coord, %s\n", rawcell.R))
|
|
|
}
|
|
|
@@ -329,7 +329,7 @@ func formulaForCell(rawcell xlsxC, sharedFormulas map[int]sharedFormula) string
|
|
|
return ""
|
|
|
}
|
|
|
if f.T == "shared" {
|
|
|
- x, y, err := getCoordsFromCellIDString(rawcell.R)
|
|
|
+ x, y, err := GetCoordsFromCellIDString(rawcell.R)
|
|
|
if err != nil {
|
|
|
res = f.Content
|
|
|
} else {
|
|
|
@@ -392,7 +392,7 @@ func formulaForCell(rawcell xlsxC, sharedFormulas map[int]sharedFormula) string
|
|
|
// shiftCell returns the cell shifted according to dx and dy taking into consideration of absolute
|
|
|
// references with dollar sign ($)
|
|
|
func shiftCell(cellID string, dx, dy int) string {
|
|
|
- fx, fy, _ := getCoordsFromCellIDString(cellID)
|
|
|
+ fx, fy, _ := GetCoordsFromCellIDString(cellID)
|
|
|
|
|
|
// Is fixed column?
|
|
|
fixedCol := strings.Index(cellID, "$") == 0
|
|
|
@@ -411,7 +411,7 @@ func shiftCell(cellID string, dx, dy int) string {
|
|
|
}
|
|
|
|
|
|
// New shifted cell
|
|
|
- shiftedCellID := getCellIDStringFromCoords(fx, fy)
|
|
|
+ shiftedCellID := GetCellIDStringFromCoords(fx, fy)
|
|
|
|
|
|
if !fixedCol && !fixedRow {
|
|
|
return shiftedCellID
|
|
|
@@ -575,7 +575,7 @@ func readRowsFromSheet(Worksheet *xlsxWorksheet, file *File, sheet *Sheet) ([]*R
|
|
|
if err != nil {
|
|
|
panic(err.Error())
|
|
|
}
|
|
|
- x, _, _ := getCoordsFromCellIDString(rawcell.R)
|
|
|
+ x, _, _ := GetCoordsFromCellIDString(rawcell.R)
|
|
|
|
|
|
// K1000000: Prevent panic when the range specified in the spreadsheet
|
|
|
// view exceeds the actual number of columns in the dataset.
|