using OfficeOpenXml.FormulaParsing.LexicalAnalysis; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace OfficeOpenXml.FormulaParsing { /// /// This class should be implemented to be able to deliver excel data /// to the formula parser. /// public abstract class ExcelDataProvider : IDisposable { /// /// A range of cells in a worksheet. /// public interface IRangeInfo : IEnumerator, IEnumerable { bool IsEmpty { get; } bool IsMulti { get; } int GetNCells(); ExcelAddressBase Address { get; } object GetValue(int row, int col); object GetOffset(int rowOffset, int colOffset); ExcelWorksheet Worksheet { get; } } /// /// Information and help methods about a cell /// public interface ICellInfo { string Address { get; } int Row { get; } int Column { get; } string Formula { get; } object Value { get; } double ValueDouble { get; } double ValueDoubleLogical { get; } bool IsHiddenRow { get; } bool IsExcelError { get; } IList Tokens { get; } } public interface INameInfo { ulong Id { get; set; } string Worksheet {get; set;} string Name { get; set; } string Formula { get; set; } IList Tokens { get; } object Value { get; set; } } /// /// Returns the names of all worksheet names /// /// public abstract ExcelNamedRangeCollection GetWorksheetNames(string worksheet); /// /// Returns all defined names in a workbook /// /// public abstract ExcelNamedRangeCollection GetWorkbookNameValues(); /// /// Returns values from the required range. /// /// The name of the worksheet /// Row /// Column /// The reference address /// public abstract IRangeInfo GetRange(string worksheetName, int row, int column, string address); public abstract INameInfo GetName(string worksheet, string name); public abstract IEnumerable GetRangeValues(string address); public abstract string GetRangeFormula(string worksheetName, int row, int column); public abstract List GetRangeFormulaTokens(string worksheetName, int row, int column); public abstract bool IsRowHidden(string worksheetName, int row); ///// ///// Returns a single cell value ///// ///// ///// //public abstract object GetCellValue(int sheetID, string address); /// /// Returns a single cell value /// /// /// /// /// public abstract object GetCellValue(string sheetName, int row, int col); ///// ///// Sets the value on the cell ///// ///// ///// //public abstract void SetCellValue(string address, object value); /// /// Returns the address of the lowest rightmost cell on the worksheet. /// /// /// public abstract ExcelCellAddress GetDimensionEnd(string worksheet); /// /// Use this method to free unmanaged resources. /// public abstract void Dispose(); /// /// Max number of columns in a worksheet that the Excel data provider can handle. /// public abstract int ExcelMaxColumns { get; } /// /// Max number of rows in a worksheet that the Excel data provider can handle /// public abstract int ExcelMaxRows { get; } public abstract object GetRangeValue(string worksheetName, int row, int column); public abstract string GetFormat(object value, string format); public abstract void Reset(); public abstract IRangeInfo GetRange(string worksheet, int fromRow, int fromCol, int toRow, int toCol); } }