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:
xuri 2023-08-15 00:01:57 +08:00
parent ae17fa87d5
commit a1810aa056
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
4 changed files with 4932 additions and 1163 deletions

View File

@ -289,5 +289,9 @@ func (m *MergeCell) GetStartAxis() string {
// GetEndAxis returns the bottom right cell reference of merged range, for
// example: "D4".
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]
}

View File

@ -80,6 +80,13 @@ func TestMergeCell(t *testing.T) {
assert.True(t, ok)
ws.(*xlsxWorksheet).MergeCells = &xlsxMergeCells{Cells: []*xlsxMergeCell{nil, nil}}
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) {

3454
numfmt.go

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff