Skip to content

Commit 3f70299

Browse files
committed
Using the specialized name in a variable and making comments clear
- Add JSON tags for `AppProperties`, `PivotTableOption` and `PivotTableField` structure
1 parent 73cc4bd commit 3f70299

31 files changed

+470
-470
lines changed

adjust.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ func (f *File) adjustAutoFilter(ws *xlsxWorksheet, dir adjustDirection, num, off
248248
}
249249

250250
// adjustAutoFilterHelper provides a function for adjusting auto filter to
251-
// compare and calculate cell axis by the given adjust direction, operation
252-
// axis and offset.
251+
// compare and calculate cell reference by the given adjust direction, operation
252+
// reference and offset.
253253
func (f *File) adjustAutoFilterHelper(dir adjustDirection, coordinates []int, num, offset int) []int {
254254
if dir == rows {
255255
if coordinates[1] >= num {
@@ -314,7 +314,7 @@ func (f *File) adjustMergeCells(ws *xlsxWorksheet, dir adjustDirection, num, off
314314
}
315315

316316
// adjustMergeCellsHelper provides a function for adjusting merge cells to
317-
// compare and calculate cell axis by the given pivot, operation axis and
317+
// compare and calculate cell reference by the given pivot, operation reference and
318318
// offset.
319319
func (f *File) adjustMergeCellsHelper(p1, p2, num, offset int) (int, int) {
320320
if p2 < p1 {

adjust_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestAdjustMergeCells(t *testing.T) {
1212
f := NewFile()
13-
// testing adjustAutoFilter with illegal cell coordinates.
13+
// testing adjustAutoFilter with illegal cell reference.
1414
assert.EqualError(t, f.adjustMergeCells(&xlsxWorksheet{
1515
MergeCells: &xlsxMergeCells{
1616
Cells: []*xlsxMergeCell{
@@ -283,7 +283,7 @@ func TestAdjustAutoFilter(t *testing.T) {
283283
Ref: "A1:A3",
284284
},
285285
}, rows, 1, -1))
286-
// Test adjustAutoFilter with illegal cell coordinates.
286+
// Test adjustAutoFilter with illegal cell reference.
287287
assert.EqualError(t, f.adjustAutoFilter(&xlsxWorksheet{
288288
AutoFilter: &xlsxAutoFilter{
289289
Ref: "A:B1",
@@ -335,7 +335,7 @@ func TestAdjustHelper(t *testing.T) {
335335
f.Sheet.Store("xl/worksheets/sheet2.xml", &xlsxWorksheet{
336336
AutoFilter: &xlsxAutoFilter{Ref: "A1:B"},
337337
})
338-
// Test adjustHelper with illegal cell coordinates.
338+
// Test adjustHelper with illegal cell reference.
339339
assert.EqualError(t, f.adjustHelper("Sheet1", rows, 0, 0), newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error())
340340
assert.EqualError(t, f.adjustHelper("Sheet2", rows, 0, 0), newCellNameToCoordinatesError("B", newInvalidCellNameError("B")).Error())
341341
// Test adjustHelper on not exists worksheet.

calc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ func (f *File) parseReference(ctx *calcContext, sheet, reference string) (arg fo
14081408
cr := cellRef{}
14091409
if len(tokens) == 2 { // have a worksheet name
14101410
cr.Sheet = tokens[0]
1411-
// cast to cell coordinates
1411+
// cast to cell reference
14121412
if cr.Col, cr.Row, err = CellNameToCoordinates(tokens[1]); err != nil {
14131413
// cast to column
14141414
if cr.Col, err = ColumnNameToNumber(tokens[1]); err != nil {
@@ -1428,7 +1428,7 @@ func (f *File) parseReference(ctx *calcContext, sheet, reference string) (arg fo
14281428
refs.PushBack(cr)
14291429
continue
14301430
}
1431-
// cast to cell coordinates
1431+
// cast to cell reference
14321432
if cr.Col, cr.Row, err = CellNameToCoordinates(tokens[0]); err != nil {
14331433
// cast to column
14341434
if cr.Col, err = ColumnNameToNumber(tokens[0]); err != nil {

calcchain.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ func (f *File) calcChainWriter() {
4545

4646
// deleteCalcChain provides a function to remove cell reference on the
4747
// calculation chain.
48-
func (f *File) deleteCalcChain(index int, axis string) {
48+
func (f *File) deleteCalcChain(index int, cell string) {
4949
calc := f.calcChainReader()
5050
if calc != nil {
5151
calc.C = xlsxCalcChainCollection(calc.C).Filter(func(c xlsxCalcChainC) bool {
52-
return !((c.I == index && c.R == axis) || (c.I == index && axis == "") || (c.I == 0 && c.R == axis))
52+
return !((c.I == index && c.R == cell) || (c.I == index && cell == "") || (c.I == 0 && c.R == cell))
5353
})
5454
}
5555
if len(calc.C) == 0 {

0 commit comments

Comments
 (0)