You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When reading an xlsx file, with cell values as "" (empty), SkipBlankLines fails skip the line (because it checks for null).
Shouldn't an empty cell be treated the same way as null? If there's a specific reason for this, is there anyway to override this logic? I'm thinking of how the base library has the FilterRow setting.
I'll attach an example sheet with some code for quick verification:
using var stream = file.OpenReadStream();
using var importer = new ExcelImporter( stream );
importer.Configuration.SkipBlankLines = true;
importer.Configuration.RegisterClassMap<EventClassMap>();
var sheet = importer.ReadSheet();
var heading = sheet.ReadHeading();
foreach (var evt in sheet.ReadRows<Event>())
{
// throws error as blank lines aren't skipped & non-nullable fields cannot be mapped to: ""
}
...
public class Event
{
public string Name { get; set; }
public string Location { get; set; }
public int Attendance { get; set; }
public DateTime Date { get; set; }
}
public class EventClassMap : ExcelClassMap<Event>
{
public EventClassMap()
{
Map( e => e.Date )
.WithDateFormats( "M/d/yyyy hh:mm:ss tt", "g" );
}
}
When reading an xlsx file, with cell values as "" (empty), SkipBlankLines fails skip the line (because it checks for null).
Shouldn't an empty cell be treated the same way as null? If there's a specific reason for this, is there anyway to override this logic? I'm thinking of how the base library has the FilterRow setting.
I'll attach an example sheet with some code for quick verification:
An example sheet can be found here
The text was updated successfully, but these errors were encountered: