mirror of
https://gitee.com/dotnetchina/MiniExcel.git
synced 2024-11-29 18:38:08 +08:00
Yield empty self-closing row tags as empty row during query. (#673)
This commit is contained in:
parent
831c814788
commit
436aaa80c9
BIN
samples/xlsx/TestEmptySelfClosingRow.xlsx
Normal file
BIN
samples/xlsx/TestEmptySelfClosingRow.xlsx
Normal file
Binary file not shown.
@ -277,7 +277,11 @@ namespace MiniExcelLibs.OpenXml
|
||||
|
||||
// row -> c
|
||||
if (!XmlReaderHelper.ReadFirstContent(reader))
|
||||
{
|
||||
//Fill in case of self closed empty row tag eg. <row r="1"/>
|
||||
yield return GetCell(useHeaderRow, maxColumnIndex, headRows, startColumnIndex);
|
||||
continue;
|
||||
}
|
||||
|
||||
// startcell pass rows
|
||||
if (rowIndex < startRowIndex)
|
||||
|
@ -252,6 +252,27 @@ namespace MiniExcelLibs.Tests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestEmptyRowsQuerySelfClosingTag()
|
||||
{
|
||||
var path = @"../../../../../samples/xlsx/TestEmptySelfClosingRow.xlsx";
|
||||
using (var stream = File.OpenRead(path))
|
||||
{
|
||||
var rows = stream.Query().ToList();
|
||||
|
||||
Assert.Equal(null, rows[0].A);
|
||||
Assert.Equal(1, rows[1].A);
|
||||
Assert.Equal(null, rows[2].A);
|
||||
Assert.Equal(2, rows[3].A);
|
||||
Assert.Equal(null, rows[4].A);
|
||||
Assert.Equal(null, rows[5].A);
|
||||
Assert.Equal(null, rows[6].A);
|
||||
Assert.Equal(null, rows[7].A);
|
||||
Assert.Equal(null, rows[8].A);
|
||||
Assert.Equal(1, rows[9].A);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact()]
|
||||
public void TestDynamicQueryBasic_WithoutHead()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user