已验证 提交 a1810aa0 编写于 作者: xurime's avatar xurime

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
上级 ae17fa87
......@@ -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]
}
......@@ -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) {
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册