Example #1
0
        private static void TestExcel()
        {
            Console.WriteLine("Test Excel File Utils");

            Excel.Application application = new Excel.Application();
            application.DisplayAlerts = false;
            Excel.Tools.Utils.CommonUtils utils = new Excel.Tools.Utils.CommonUtils(application);

            string fileName = utils.File.Combine("C:\\MyFiles", "Test01", Excel.Tools.DocumentFormat.Normal);

            application.Quit();
            application.Dispose();

            if (utils.ApplicationIs2007OrHigher)
            {
                if ("C:\\MyFiles\\Test01.xlsx" != fileName)
                {
                    throw new Exception("Unexpected excel filename");
                }
            }
            else
            {
                if ("C:\\MyFiles\\Test01.xls" != fileName)
                {
                    throw new Exception("Unexpected excel filename");
                }
            }
        }
Example #2
0
        private static void TestExcel()
        {
            Console.WriteLine("Test Excel File Utils");

            Excel.Application application = new Excel.Application();
            application.DisplayAlerts = false;
            Excel.Tools.Utils.CommonUtils utils = new Excel.Tools.Utils.CommonUtils(application);

            string fileName = utils.File.Combine("C:\\MyFiles", "Test01", Excel.Tools.DocumentFormat.Normal);

            application.Quit();
            application.Dispose();

            if (utils.ApplicationIs2007OrHigher)
            {
                if ("C:\\MyFiles\\Test01.xlsx" != fileName)
                    throw new Exception("Unexpected excel filename");
            }
            else
            {
                if ("C:\\MyFiles\\Test01.xls" != fileName)
                    throw new Exception("Unexpected excel filename");
            }
        }