Пример #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);
 }