| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 | 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();        /// <summary>        /// Sets the column width with a certain number of characters        /// </summary>        /// <param name="column"></param>        /// <param name="charWidth"></param>        /// <returns></returns>        ISheet SetColumnWidth(int column, float charWidth);        ISheet MergeCells(int firstRow, int lastRow, int firstColumn, int lastColumn);        IEnumerable<IRow> Rows();        IEnumerator<IRow> 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);        /// <summary>        /// Make a new sheet and add it to the spreadsheet        /// </summary>        /// <param name="name">The name of the new sheet</param>        /// <returns>The new sheet</returns>        public ISheet NewSheet(string name);        /// <summary>        /// Make a new sheet and add it to the spreadsheet        /// </summary>        /// <returns>The new sheet</returns>        public ISheet NewSheet();        public IEnumerable<ISheet> Sheets();        public IEnumerator<ISheet> SheetEnumerator();        public ICellStyle NewStyle();        public IDataFormat GetDataFormat(string format);        public void Write(FileStream file);        public void Write(string filename, FileMode mode = FileMode.Create);    }}
 |