Esempio n. 1
0
        public static string SaveAndClose(ref ExcelWorker ex, string prefix)
        {
            string filename = prefix + "_" + DateTime.Now.ToShortDateString() + "_" +
                              new Random().Next(100, 999).ToString();

            string fileFullName = Environment.TlOutputPath + filename + ".xls";

            ex.SaveAs(fileFullName);
            ex.Close();

            return(fileFullName);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ExcelWorker test = new ExcelWorker("D:/table.xlsx");

            try
            {
                test.Open(ReadOnly: false);
                int rows    = test.Rows;
                int columns = test.Columns;
                //2:51
                for (int i = 1; i <= 10; i++)
                {
                    object[] str = test.ReadRow(i);
                }



                test.Close();
            }
            catch (Exception e)
            {
                test.Close();
            }
        }