Exemplo n.º 1
0
        public void TestSetCell2()
        {
            IExcelPlugin excel = new ExcelPlugin();

            foreach (var filePath in ExcelFiles)
            {
                var workbook = excel.OpenExcel(filePath);
                var sheet    = excel.GetSheet(workbook, 0);
                if (sheet == null)
                {
                    continue;
                }

                var result = excel.WriteCell(sheet, 5, 5, "just for test value");
                excel.Save(workbook, filePath);

                if (result)
                {
                    Assert.IsTrue(true);
                }
                else
                {
                    Assert.IsTrue(false);
                }
            }
        }
Exemplo n.º 2
0
        public void TestReadRange()
        {
            IExcelPlugin excel = new ExcelPlugin();

            foreach (var filePath in ExcelFiles)
            {
                var workbook = excel.OpenExcel(filePath);
                var sheet    = excel.GetSheet(workbook, 0);
                var result   = excel.ReadRange(sheet, "A1:F6");

                foreach (var item in result)
                {
                    Console.WriteLine(item.ToString());
                }

                if (result.Count == 36)
                {
                    Assert.IsTrue(true);
                }
                else
                {
                    Assert.IsTrue(false);
                }
            }
        }
Exemplo n.º 3
0
        public void TestGetColumsCount()
        {
            IExcelPlugin excel = new ExcelPlugin();

            foreach (var filePath in ExcelFiles)
            {
                var workbook = excel.OpenExcel(filePath);
                var sheet    = excel.GetSheet(workbook, 0);
                var result   = excel.GetColumsCount(sheet);
                Console.WriteLine(result);
            }
        }
Exemplo n.º 4
0
        public void TestReadRow()
        {
            IExcelPlugin excel = new ExcelPlugin();

            foreach (var filePath in ExcelFiles)
            {
                var workbook = excel.OpenExcel(filePath);
                var sheet    = excel.GetSheet(workbook, 0);
                var result   = excel.ReadRow(sheet, 5);
                if (result.Count >= 0)
                {
                    Assert.IsTrue(true);
                }
                else
                {
                    Assert.IsTrue(false);
                }
            }
        }