User1059168712 posted
The data is taken from Excel, using ClosedXML. The problem is that I have no idea how many values will be in the column. Maybe 5, maybe more. Therefore, I want ClosedXML to take into account all the filled cells in the range and add them to the list.
Here's what my code looks like now: I take the values manually, from each cell.
var tasks = workbook.Worksheet(1);
Tasks = new List<Task>()
{
new Task()
{
TaskName = tasks.Cell("A2").GetFormattedString(),
TaskStart = tasks.Cell("B2").GetFormattedString(),
TaskEnd = tasks.Cell("C2").GetFormattedString(),
TaskStatus = tasks.Cell("D2").GetFormattedString()
},
new Task()
{
TaskName = tasks.Cell("A3").GetFormattedString(),
TaskStart = tasks.Cell("B3").GetFormattedString(),
TaskEnd = tasks.Cell("C3").GetFormattedString(),
TaskStatus = tasks.Cell("D3").GetFormattedString()
}}