Example #1
0
        private IEnumerable <PartsSelectionTreeElement> CreatePartsSelectionTreeElements(OpenXmlElement element, int id, Predicate <OpenXmlElement> isSupportedType)
        {
            List <PartsSelectionTreeElement> result = new List <PartsSelectionTreeElement>();

            if (isSupportedType(element))
            {
                if (element is Sheet)
                {
                    string sheetName = string.Format("{0}", (element as Sheet).Name);
                    result.Add(new PartsSelectionTreeElement(id.ToString(), ExcelDocumentPartAttributes.GetSlideIdFormatter(id), sheetName, 0, ElementType.Sheet));
                }
                else if (element is Row)
                {
                    string rowName = string.Format("Row index: {0}", (element as Row).RowIndex);
                    result.Add(new PartsSelectionTreeElement(id.ToString(), (element as Row).RowIndex, rowName, 1, ElementType.Row));
                }
                else if (element is Column)
                {
                }
                else if (element is Cell)
                {
                    string cellName = string.Format("Cell name: {0}", (element as Cell).CellReference.Value);
                    result.Add(new PartsSelectionTreeElement(id.ToString(), (element as Cell).CellReference.Value, cellName, 2, ElementType.Cell));
                }
            }

            return(result);
        }
Example #2
0
 public List <PartsSelectionTreeElement> GetSheets(Stream file)
 {
     return(Get(file, el => ExcelDocumentPartAttributes.IsSupportedType(el)));
 }