Exemplo n.º 1
0
        public ExcelSheet(ExcelFile file, Worksheet sheet)
        {
            Contract.Requires<ArgumentNullException>(file != null);
            Contract.Requires<ArgumentNullException>(sheet != null);
            Contract.Requires<ArgumentNullException>(sheet.Cells != null);

            File = file;
            Sheet = sheet;
        }
Exemplo n.º 2
0
        public void Test()
        {
            var fileName = "test.xls";

            using (var excelFile = new ExcelFile(fileName))
            {
                var sheet = excelFile.GetSheet("abc", createIfAbsent: true);

                sheet[3, "C"] = "ABC";

                sheet[3, "D"] = "'01";

                excelFile.Save();
            }
            try
            {
                using (var excelFile = new ExcelFile(fileName))
                {
                    var sheet = excelFile.GetSheet("abc");

                    Assert.AreEqual("ABC", sheet[3, "C"]);

                    Assert.AreEqual("01", sheet[3, "D"]);
                }
            }
            finally
            {
                File.Delete(fileName);
            }
        }