diff options
author | Thomas Charbonnel <thomascharbonnel@users.noreply.github.com> | 2022-08-11 00:20:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-11 00:20:48 +0800 |
commit | ed91cddea59ce15da87ab744ac20b465a36ed5ef (patch) | |
tree | 1ab4a75b5a903e20253a93393bc9561bb86ed186 /rows_test.go | |
parent | b8ceaf7bf61daecad8717abec90a8e0badb64806 (diff) |
This closes #1296, add new function `GetRowOpts` for stream reader (#1297)
- Support get rows properties by `GetRowOpts` function
- New exported constant `MaxCellStyles`
Diffstat (limited to 'rows_test.go')
-rw-r--r-- | rows_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/rows_test.go b/rows_test.go index 4fe2851..4b57c34 100644 --- a/rows_test.go +++ b/rows_test.go @@ -96,6 +96,30 @@ func TestRowsIterator(t *testing.T) { assert.Equal(t, expectedNumRow, rowCount) } +func TestRowsGetRowOpts(t *testing.T) { + sheetName := "Sheet2" + expectedRowStyleID1 := RowOpts{Height: 17.0, Hidden: false, StyleID: 1} + expectedRowStyleID2 := RowOpts{Height: 17.0, Hidden: false, StyleID: 0} + expectedRowStyleID3 := RowOpts{Height: 17.0, Hidden: false, StyleID: 2} + f, err := OpenFile(filepath.Join("test", "Book1.xlsx")) + require.NoError(t, err) + + rows, err := f.Rows(sheetName) + require.NoError(t, err) + + rows.Next() + rows.Columns() // Columns() may change the XML iterator, so better check with and without calling it + got := rows.GetRowOpts() + assert.Equal(t, expectedRowStyleID1, got) + rows.Next() + got = rows.GetRowOpts() + assert.Equal(t, expectedRowStyleID2, got) + rows.Next() + rows.Columns() + got = rows.GetRowOpts() + assert.Equal(t, expectedRowStyleID3, got) +} + func TestRowsError(t *testing.T) { f, err := OpenFile(filepath.Join("test", "Book1.xlsx")) if !assert.NoError(t, err) { |