예제 #1
0
        private void CreateDataValues()
        {
            var mapping = _mappingInfoToExcel.OrderBy(mi => mi.ColumnIndex);
            var objects = _objectDataToExcel.ToList();

            _dataValues = new object[_objectDataToExcel.Count(), HeaderValues.Count()];

            for (int objectIndex = 0; objectIndex < objects.Count(); objectIndex++)
            {
                foreach (var mappingInfo in _mappingInfoToExcel.OrderBy(mi => mi.ColumnIndex))
                {
                    if (mappingInfo.IsDynamicRange)
                    {
                        var offset = 0;
                        foreach (var value in GetDynamicValues(mappingInfo, objects[objectIndex]))
                        {
                            _dataValues[objectIndex, mappingInfo.ColumnIndex + offset] = value;
                            offset++;
                        }
                    }
                    else
                    {
                        _dataValues[objectIndex, mappingInfo.ColumnIndex] = GetValue(mappingInfo, objects[objectIndex]);
                    }
                }
            }
        }
예제 #2
0
 private object[,] CoyyHeadersInToResult(object[,] result)
 {
     for (int i = 0; i < HeaderValues.Count(); i++)
     {
         result[0, i] = HeaderValues[i];
     }
     return(result);
 }