예제 #1
0
        public CellRangeTemplate CreateCellRangeTemplate(string name, List <string> names)
        {
            CellRangeTemplate result = CreateCellRangeTemplate(name);

            result.BuildNumericIndexing(names);

            return(result);
        }
예제 #2
0
 public void InsertRange(CellRangeTemplate template, IEnumerable <List <object> > entities)
 {
     foreach (var entity in entities)
     {
         template.Assign(entity);
         InsertRange(template.Range);
     }
 }
예제 #3
0
        public CellRangeTemplate CreateCellRangeTemplate(CellRangeRef range)
        {
            CellRangeTemplate result = new CellRangeTemplate(range);

            var cells = FindCellsByRange(range);

            foreach (var rowGroup in cells)
            {
                foreach (Cell cell in rowGroup)
                {
                    if (cell.DataType != null && cell.CellValue != null)
                    {
                        string stringValue = null;

                        switch (cell.DataType.Value)
                        {
                        case CellValues.SharedString:
                        {
                            int index = int.Parse(cell.CellValue.Text);
                            SharedStringItem stringItem = document.WorkbookPart.SharedStringTablePart.SharedStringTable.Elements <SharedStringItem>().ElementAt(index);

                            stringValue = stringItem.InnerText;
                            break;
                        }

                        case CellValues.String:
                        {
                            stringValue = cell.CellValue.Text;
                            break;
                        }
                        }

                        if (PARAM_PATTERN.IsMatch(stringValue))
                        {
                            var match     = PARAM_PATTERN.Match(stringValue);
                            var paramName = match.Groups[1].Value;
                            result.AddCell(paramName, cell);
                        }
                    }
                }
            }

            return(result);
        }
예제 #4
0
 public void InsertRange(CellRangeTemplate template, List <object> entity)
 {
     template.Assign(entity);
     InsertRange(template.Range);
 }
예제 #5
0
 public void InsertRange(CellRangeTemplate template)
 {
     InsertRange(template.Range);
 }