private List<List<string>> GetValuesFromRows(WorksheetPart worksheetPart, List<long> variableList, int startRow, int endRow)
{
List<List<string>> temp = new List<List<string>>();
OpenXmlReader reader = OpenXmlReader.Create(worksheetPart);
int count = 0;
int rowNum = 0;
while (reader.Read())
{
if (reader.ElementType == typeof(Row))
{
do
{
if (reader.HasAttributes)
rowNum = Convert.ToInt32(reader.Attributes.First(a => a.LocalName == "r").Value);
if (endRow == 0)
{
if (rowNum >= startRow)
{
Row row = (Row)reader.LoadCurrentElement();
temp.Add(RowToList(row, variableList));
count++;
}
}
else
{
if (rowNum >= startRow && rowNum <= endRow)
{
Row row = (Row)reader.LoadCurrentElement();
temp.Add(RowToList(row, variableList));
count++;
}
}
} while (reader.ReadNextSibling()); // Skip to the next row
break;
}
}
return temp;
}