1 | using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
|
---|
2 | using System;
|
---|
3 | using System.Collections.Generic;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Text;
|
---|
6 |
|
---|
7 | namespace 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 | public interface ICellInfo : IEnumerator<ICellInfo>, IEnumerable<ICellInfo>
|
---|
16 | {
|
---|
17 | string Address { get; }
|
---|
18 | int Row { get; }
|
---|
19 | int Column { get; }
|
---|
20 | string Formula { get; }
|
---|
21 | object Value { get; }
|
---|
22 | double ValueDouble { get; }
|
---|
23 | double ValueDoubleLogical { get; }
|
---|
24 | bool IsHiddenRow { get; }
|
---|
25 | bool IsEmpty { get; }
|
---|
26 | bool IsMulti { get; }
|
---|
27 | bool NextCell();
|
---|
28 | IList<Token> Tokens { get; }
|
---|
29 | int GetNCells();
|
---|
30 | }
|
---|
31 | public interface INameInfo
|
---|
32 | {
|
---|
33 | ulong Id { get; set; }
|
---|
34 | string Name { get; set; }
|
---|
35 | string Formula { get; set; }
|
---|
36 | IList<Token> Tokens { get; }
|
---|
37 | object Value { get; set; }
|
---|
38 | }
|
---|
39 | /// <summary>
|
---|
40 | /// Returns the names of all worksheet names
|
---|
41 | /// </summary>
|
---|
42 | /// <returns></returns>
|
---|
43 | public abstract ExcelNamedRangeCollection GetWorksheetNames();
|
---|
44 | /// <summary>
|
---|
45 | /// Returns all defined names in a workbook
|
---|
46 | /// </summary>
|
---|
47 | /// <returns></returns>
|
---|
48 | public abstract ExcelNamedRangeCollection GetWorkbookNameValues();
|
---|
49 | /// <summary>
|
---|
50 | /// Returns values from the required range.
|
---|
51 | /// </summary>
|
---|
52 | /// <param name="address">An Excel address</param>
|
---|
53 | /// <returns>values from the required cells</returns>
|
---|
54 | public abstract ICellInfo GetRange(string worksheetName, int row, int column, string address);
|
---|
55 | public abstract INameInfo GetName(string worksheet, string name);
|
---|
56 |
|
---|
57 | public abstract IEnumerable<object> GetRangeValues(string address);
|
---|
58 |
|
---|
59 | public abstract string GetRangeFormula(string worksheetName, int row, int column);
|
---|
60 | public abstract List<Token> GetRangeFormulaTokens(string worksheetName, int row, int column);
|
---|
61 | public abstract bool IsRowHidden(string worksheetName, int row);
|
---|
62 | ///// <summary>
|
---|
63 | ///// Returns a single cell value
|
---|
64 | ///// </summary>
|
---|
65 | ///// <param name="address"></param>
|
---|
66 | ///// <returns></returns>
|
---|
67 | //public abstract object GetCellValue(int sheetID, string address);
|
---|
68 |
|
---|
69 | /// <summary>
|
---|
70 | /// Returns a single cell value
|
---|
71 | /// </summary>
|
---|
72 | /// <param name="row"></param>
|
---|
73 | /// <param name="col"></param>
|
---|
74 | /// <returns></returns>
|
---|
75 | public abstract object GetCellValue(string sheetName, int row, int col);
|
---|
76 |
|
---|
77 | ///// <summary>
|
---|
78 | ///// Sets the value on the cell
|
---|
79 | ///// </summary>
|
---|
80 | ///// <param name="address"></param>
|
---|
81 | ///// <param name="value"></param>
|
---|
82 | //public abstract void SetCellValue(string address, object value);
|
---|
83 |
|
---|
84 | /// <summary>
|
---|
85 | /// Use this method to free unmanaged resources.
|
---|
86 | /// </summary>
|
---|
87 | public abstract void Dispose();
|
---|
88 |
|
---|
89 | /// <summary>
|
---|
90 | /// Max number of columns in a worksheet that the Excel data provider can handle.
|
---|
91 | /// </summary>
|
---|
92 | public abstract int ExcelMaxColumns { get; }
|
---|
93 |
|
---|
94 | /// <summary>
|
---|
95 | /// Max number of rows in a worksheet that the Excel data provider can handle
|
---|
96 | /// </summary>
|
---|
97 | public abstract int ExcelMaxRows { get; }
|
---|
98 |
|
---|
99 | public abstract object GetRangeValue(string worksheetName, int row, int column);
|
---|
100 | }
|
---|
101 | }
|
---|