Пример #1
0
        public void TestExcelImportStream()
        {
            string filename = PathToTestData + "testReading.xlsx";

            // display error messages in english
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");

            TLogging.Log("reading " + filename);
            using (FileStream fs = File.OpenRead(filename))
            {
                DataTable table = TCsv2Xml.ParseExcelWorkbook2DataTable(fs, true);

                Assert.AreEqual("test1", table.Columns[0].ColumnName, "name of first column");
                Assert.AreEqual("1", table.Rows[0][0].ToString(), "value of first row, first column");
                Assert.AreEqual("2", table.Rows[0]["test2"].ToString(), "value of first row, second column");
                Assert.AreEqual("vier", table.Rows[0][3].ToString(), "value of first row, forth column");
            }
        }