OpenXml.Excel.Data.ExcelDataReader.AdjustRow C# (CSharp) Method

AdjustRow() private static method

private static AdjustRow ( OpenXmlElement row, int capacity ) : IEnumerable
row OpenXmlElement
capacity int
return IEnumerable
        private static IEnumerable<Cell> AdjustRow(OpenXmlElement row, int capacity)
        {
            if (row == null)
                return new Cell[] {};

            var cells = row.Elements<Cell>();

            var list = new Cell[capacity];
            foreach (var cell in cells)
            {
                var index = ExcelUtil.GetColumnIndexByName(cell.CellReference.Value);
                if (index < capacity)
                    list[index] = cell;
            }

            return list;
        }