using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InABox.Scripting { public interface IDataFormat { public short FormatIndex { get; } } public interface ICellStyle { public IDataFormat DataFormat { get; set; } } public interface ISheet { public string Name { get; } IRow NewRow(); /// /// Sets the column width with a certain number of characters /// /// /// /// ISheet SetColumnWidth(int column, float charWidth); ISheet MergeCells(int firstRow, int lastRow, int firstColumn, int lastColumn); IEnumerable Rows(); IEnumerator RowEnumerator(); } public interface IRow { public int RowNumber { get; } public ICell this[int column] { get { return GetCell(column); } } public string ExtractString(int column, bool uppercase = false); public DateTime ExtractDateTime(int column); public double? ExtractDouble(int column); public int GetColumn(string name, bool throwException = true); public ICell GetCell(int column); public ICell NewCell(int column); } public interface ICell { string GetValue(); bool? GetBoolValue(); double? GetDoubleValue(); DateTime GetDateTimeValue(); byte? GetByteValue(); ICell SetValue(bool value); ICell SetValue(string value); ICell SetValue(double value); ICell SetValue(DateTime value); ICell SetValue(byte value); ICell SetBlank(); ICell SetStyle(ICellStyle style); } public interface ISpreadsheet { public ISheet GetSheet(int index); public ISheet GetSheet(string name); /// /// Make a new sheet and add it to the spreadsheet /// /// The name of the new sheet /// The new sheet public ISheet NewSheet(string name); /// /// Make a new sheet and add it to the spreadsheet /// /// The new sheet public ISheet NewSheet(); public IEnumerable Sheets(); public IEnumerator SheetEnumerator(); public ICellStyle NewStyle(); public IDataFormat GetDataFormat(string format); public void Write(FileStream file); public void Write(string filename, FileMode mode = FileMode.Create); } }