Esempio n. 1
0
        public void SaveSheetAsTextWithRange()
        {
            ExcelFile file = new ExcelFile();

            file.FileName     = System.IO.Path.Combine(m_ApplicationDirectory, "DateTimeCombineExcel.xlsx");
            file.SheetName    = "Combinations";
            file.SheetRange   = "A12:D24";
            file.ShowProgress = false;
            using (ExcelFileReaderInterop reader = new ExcelFileReaderInterop())
            {
                reader.Open(file, System.Threading.CancellationToken.None, false);
                reader.SaveSheetAsText(null, null, m_Output);
            }
            Assert.IsTrue(File.Exists(m_Output));
        }
Esempio n. 2
0
        public void SaveSheetAsTextWithRangeAndProcess()
        {
            ExcelFile file = new ExcelFile();

            file.FileName     = System.IO.Path.Combine(m_ApplicationDirectory, "DateTimeCombineExcel.xlsx");
            file.SheetName    = "Combinations";
            file.SheetRange   = "B1:B5";
            file.ShowProgress = false;
            using (ExcelFileReaderInterop reader = new ExcelFileReaderInterop())
            {
                using (FormProcessDisplay disp = new FormProcessDisplay("Test", null, null))
                {
                    reader.ProcessDisplay = disp;
                    reader.Open(file, System.Threading.CancellationToken.None, true);
                    reader.SaveSheetAsText(disp, null, m_Output);
                }
            }
            Assert.IsTrue(File.Exists(m_Output));
        }
Esempio n. 3
0
        public void ExcelFileReaderOpenWrongSheetName()
        {
            try
            {
                ExcelFile file = new ExcelFile();
                file.FileName     = System.IO.Path.Combine(m_ApplicationDirectory, "DateTimeCombineExcel.xlsx");
                file.SheetName    = "Combin ations";
                file.SheetRange   = null;
                file.ShowProgress = false;

                using (ExcelFileReaderInterop reader = new ExcelFileReaderInterop())
                {
                    reader.Open(file, System.Threading.CancellationToken.None, false);
                    reader.SaveSheetAsText(null, null, m_Output);
                }
            }
            catch (Exception)
            {
                return;
            }
            Assert.Fail("Expected Exception");
        }