20 lines
565 B
C#
20 lines
565 B
C#
|
|
using OfficeOpenXml;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
namespace BMA.EHR.Recruit.Service.Extensions
|
|||
|
|
{
|
|||
|
|
public static class ExcelWorksheetExtension
|
|||
|
|
{
|
|||
|
|
public static string[] GetHeaderColumns(this ExcelWorksheet sheet, int row = 1)
|
|||
|
|
{
|
|||
|
|
List<string> columnNames = new List<string>();
|
|||
|
|
foreach (var firstRowCell in sheet.Cells[row, sheet.Dimension.Start.Column, 1, sheet.Dimension.End.Column])
|
|||
|
|
columnNames.Add(firstRowCell.Text);
|
|||
|
|
return columnNames.ToArray();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|