This improves the date and time number formats
- Now support applying date and time number format for 812 language tags - Fix panic on getting merged cells with the same start and end axis
This commit is contained in:
parent
ae17fa87d5
commit
a1810aa056
6
merge.go
6
merge.go
|
@ -289,5 +289,9 @@ func (m *MergeCell) GetStartAxis() string {
|
||||||
// GetEndAxis returns the bottom right cell reference of merged range, for
|
// GetEndAxis returns the bottom right cell reference of merged range, for
|
||||||
// example: "D4".
|
// example: "D4".
|
||||||
func (m *MergeCell) GetEndAxis() string {
|
func (m *MergeCell) GetEndAxis() string {
|
||||||
return strings.Split((*m)[0], ":")[1]
|
coordinates := strings.Split((*m)[0], ":")
|
||||||
|
if len(coordinates) == 2 {
|
||||||
|
return coordinates[1]
|
||||||
|
}
|
||||||
|
return coordinates[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,13 @@ func TestMergeCell(t *testing.T) {
|
||||||
assert.True(t, ok)
|
assert.True(t, ok)
|
||||||
ws.(*xlsxWorksheet).MergeCells = &xlsxMergeCells{Cells: []*xlsxMergeCell{nil, nil}}
|
ws.(*xlsxWorksheet).MergeCells = &xlsxMergeCells{Cells: []*xlsxMergeCell{nil, nil}}
|
||||||
assert.NoError(t, f.MergeCell("Sheet1", "A2", "B3"))
|
assert.NoError(t, f.MergeCell("Sheet1", "A2", "B3"))
|
||||||
|
// Test getting merged cells with the same start and end axis
|
||||||
|
ws.(*xlsxWorksheet).MergeCells = &xlsxMergeCells{Cells: []*xlsxMergeCell{{Ref: "A1"}}}
|
||||||
|
mergedCells, err := f.GetMergeCells("Sheet1")
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, "A1", mergedCells[0].GetStartAxis())
|
||||||
|
assert.Equal(t, "A1", mergedCells[0].GetEndAxis())
|
||||||
|
assert.Empty(t, mergedCells[0].GetCellValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMergeCellOverlap(t *testing.T) {
|
func TestMergeCellOverlap(t *testing.T) {
|
||||||
|
|
2616
numfmt_test.go
2616
numfmt_test.go
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue