Skip to content

Commit

Permalink
Cleaned up formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecole committed Oct 2, 2016
1 parent e9354ee commit 3a9c601
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/EPPlus.Extensions/EPPlusExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public static DataSet ToDataSet(this ExcelPackage package, bool firstRowContains
return ToDataSet(package, headerRow);
}


/// <summary>
/// Extracts a DataSet from the ExcelPackage.
/// </summary>
Expand All @@ -34,8 +33,8 @@ public static DataSet ToDataSet(this ExcelPackage package, int headerRow = 0)
{
throw new ArgumentException("headerRow must be 0 or greater.");
}
var result = new DataSet();

var result = new DataSet();

foreach (var sheet in package.Workbook.Worksheets)
{
Expand All @@ -49,13 +48,10 @@ public static DataSet ToDataSet(this ExcelPackage package, int headerRow = 0)
var columns = from firstRowCell in sheet.Cells[sheetStartRow, 1, sheetStartRow, sheet.Dimension.End.Column]
select new DataColumn(headerRow > 0 ? firstRowCell.Text : $"Column {firstRowCell.Start.Column}");


table.Columns.AddRange(columns.ToArray());


var startRow = headerRow > 0 ? sheetStartRow + 1 : sheetStartRow;


for (var rowIndex = startRow; rowIndex <= sheet.Dimension.End.Row; rowIndex++)
{
var inputRow = sheet.Cells[rowIndex, 1, rowIndex, sheet.Dimension.End.Column];
Expand All @@ -66,13 +62,10 @@ public static DataSet ToDataSet(this ExcelPackage package, int headerRow = 0)
}
}


result.Tables.Add(table);
}


return result;
}

}
}

0 comments on commit 3a9c601

Please sign in to comment.