Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs @ 15572

Last change on this file since 15572 was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 4.9 KB
Line 
1using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6
7namespace OfficeOpenXml.FormulaParsing
8{
9    /// <summary>
10    /// This class should be implemented to be able to deliver excel data
11    /// to the formula parser.
12    /// </summary>
13    public abstract class ExcelDataProvider : IDisposable
14    {
15        /// <summary>
16        /// A range of cells in a worksheet.
17        /// </summary>
18        public interface IRangeInfo : IEnumerator<ICellInfo>, IEnumerable<ICellInfo>
19        {
20            bool IsEmpty { get; }
21            bool IsMulti { get; }
22            int GetNCells();
23            ExcelAddressBase Address { get; }
24            object GetValue(int row, int col);
25            object GetOffset(int rowOffset, int colOffset);
26
27            ExcelWorksheet Worksheet { get; }
28        }
29        /// <summary>
30        /// Information and help methods about a cell
31        /// </summary>
32        public interface ICellInfo
33        {
34            string Address { get; }
35            int Row { get; }
36            int Column { get; }
37            string Formula { get;  }
38            object Value { get; }
39            double ValueDouble { get; }
40            double ValueDoubleLogical { get; }
41            bool IsHiddenRow { get; }
42            bool IsExcelError { get; }
43            IList<Token> Tokens { get; }   
44        }
45        public interface INameInfo
46        {
47            ulong Id { get; set; }
48            string Worksheet {get; set;}
49            string Name { get; set; }
50            string Formula { get; set; }
51            IList<Token> Tokens { get; }
52            object Value { get; set; }
53        }
54        /// <summary>
55        /// Returns the names of all worksheet names
56        /// </summary>
57        /// <returns></returns>
58        public abstract ExcelNamedRangeCollection GetWorksheetNames(string worksheet);
59        /// <summary>
60        /// Returns all defined names in a workbook
61        /// </summary>
62        /// <returns></returns>
63        public abstract ExcelNamedRangeCollection GetWorkbookNameValues();
64        /// <summary>
65        /// Returns values from the required range.
66        /// </summary>
67        /// <param name="worksheetName">The name of the worksheet</param>
68        /// <param name="row">Row</param>
69        /// <param name="column">Column</param>
70        /// <param name="address">The reference address</param>
71        /// <returns></returns>
72        public abstract IRangeInfo GetRange(string worksheetName, int row, int column, string address);
73        public abstract INameInfo GetName(string worksheet, string name);
74
75        public abstract IEnumerable<object> GetRangeValues(string address);
76
77        public abstract string GetRangeFormula(string worksheetName, int row, int column);
78        public abstract List<Token> GetRangeFormulaTokens(string worksheetName, int row, int column);
79        public abstract bool IsRowHidden(string worksheetName, int row);
80        ///// <summary>
81        ///// Returns a single cell value
82        ///// </summary>
83        ///// <param name="address"></param>
84        ///// <returns></returns>
85        //public abstract object GetCellValue(int sheetID, string address);
86
87        /// <summary>
88        /// Returns a single cell value
89        /// </summary>
90        /// <param name="sheetName"></param>
91        /// <param name="row"></param>
92        /// <param name="col"></param>
93        /// <returns></returns>
94        public abstract object GetCellValue(string sheetName, int row, int col);
95
96        ///// <summary>
97        ///// Sets the value on the cell
98        ///// </summary>
99        ///// <param name="address"></param>
100        ///// <param name="value"></param>
101        //public abstract void SetCellValue(string address, object value);
102
103        /// <summary>
104        /// Returns the address of the lowest rightmost cell on the worksheet.
105        /// </summary>
106        /// <param name="worksheet"></param>
107        /// <returns></returns>
108        public abstract ExcelCellAddress GetDimensionEnd(string worksheet);
109
110        /// <summary>
111        /// Use this method to free unmanaged resources.
112        /// </summary>
113        public abstract void Dispose();
114
115        /// <summary>
116        /// Max number of columns in a worksheet that the Excel data provider can handle.
117        /// </summary>
118        public abstract int ExcelMaxColumns { get; }
119
120        /// <summary>
121        /// Max number of rows in a worksheet that the Excel data provider can handle
122        /// </summary>
123        public abstract int ExcelMaxRows { get; }
124
125        public abstract object GetRangeValue(string worksheetName, int row, int column);
126        public abstract string GetFormat(object value, string format);
127
128        public abstract void Reset();
129        public abstract IRangeInfo GetRange(string worksheet, int fromRow, int fromCol, int toRow, int toCol);
130    }
131}
Note: See TracBrowser for help on using the repository browser.