Exemplo n.º 1
0
        public static void CompareCellsOnTheSameWorkbook(ComparisonWorkbookBase source, string filename)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two cells on the same workbook and the same worksheet");
            var result = source.Worksheets[0].CellRange["A1"].CompareWith(source.Worksheets[0].CellRange["B1"], settings);

            Console.WriteLine("Comparison Done. Creating a file with result changes");
            result.GetWorkbook().Save(filename);
            Console.WriteLine("File with result changes was successfully created\n\n");
        }
Exemplo n.º 2
0
        public static void CompareErrorCellWithNonError(ComparisonWorkbookBase source, ComparisonWorkbookBase target,
                                                        string filename)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two cells on different workbook where source and target cells contain plain text");
            var result = source.Worksheets[0].CellRange["A6"].CompareWith(target.Worksheets[0].CellRange["A6"], settings);

            Console.WriteLine("Comparison Done. Creating a file with result changes");
            result.GetWorkbook().Save(filename);
            Console.WriteLine("File with result changes was successfully created\n\n");
        }
        public static void CompareWorksheetsFromOneDocuments(ComparisonWorkbookBase source, string filePath, string imagePath)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two worksheet from one workbook");
            var result = source.Worksheets[1].CompareWith(source.Worksheets[2], settings);

            Console.WriteLine("Worksheets were successfully compared");
            result.GetWorkbook().Save(filePath);
            Console.WriteLine("Results were successfully saved to a file");
            result.GetWorkbook().SaveAsImages(imagePath);
            Console.WriteLine("Results were successfully saved to a bunch of images\n\n");
        }
Exemplo n.º 4
0
        public static void CompareTwoWorkbooks(ComparisonWorkbookBase source, ComparisonWorkbookBase target, string filePath,
                                               string imagePath)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two workbooks with the same quantity of worksheets");
            var result = source.CompareWith(target, settings);

            Console.WriteLine("Workbooks were successfully compared");
            result.GetWorkbook().Save(filePath);
            Console.WriteLine("Results were successfully saved to file");
            result.GetWorkbook().SaveAsImages(imagePath);
            Console.WriteLine("Results were successfully saved to a bunch of images\n\n");
        }
        public static void CompareWorksheetsWithDifferentContent(ComparisonWorkbookBase source, ComparisonWorkbookBase target,
                                                                 string filePath, string imagePath)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two worksheet with different content");
            var result = source.Worksheets[3].CompareWith(target.Worksheets[3], settings);

            Console.WriteLine("Worksheets were successfully compared");
            result.GetWorkbook().Save(filePath);
            Console.WriteLine("Results were successfully saved to a file");
            result.GetWorkbook().SaveAsImages(imagePath);
            Console.WriteLine("Results were successfully saved to a bunch of images\n\n");
        }
Exemplo n.º 6
0
        public static void CompareTwoWorkbooksWithDeletedAndAddedWorksheets(ComparisonWorkbookBase source,
                                                                            ComparisonWorkbookBase target, string filePath, string imagePath)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine(
                "Comparing two workbooks where both of them contain worksheets that are not presented in the opponent document");
            var result = source.CompareWith(target, settings);

            Console.WriteLine("Workbooks were successfully compared");
            result.GetWorkbook().Save(filePath);
            Console.WriteLine("Results were successfully saved to file");
            result.GetWorkbook().SaveAsImages(imagePath);
            Console.WriteLine("Results were successfully saved to a bunch of images\n\n");
        }
Exemplo n.º 7
0
        public static void CompareTwoWorkbooksWithDeletedWorksheets(ComparisonWorkbookBase source, ComparisonWorkbookBase target,
                                                                    string filePath, string imagePath)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine(
                "Comparing two workbooks where target document doesn't contain some worksheets from source workbook");
            var result = source.CompareWith(target, settings);

            Console.WriteLine("Workbooks were successfully compared");
            result.GetWorkbook().Save(filePath);
            Console.WriteLine("Results were successfully saved to file");
            result.GetWorkbook().SaveAsImages(imagePath);
            Console.WriteLine("Results were successfully saved to a bunch of images\n\n");
        }
        public static void CompareEmptyWorksheetWithNotEmpty(ComparisonWorkbookBase source, ComparisonWorkbookBase target,
                                                             string filePath, string imagePath)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two worksheet first worksheet is empty");
            var result = source.Worksheets[3].CompareWith(target.Worksheets[1], settings);

            Console.WriteLine("Worksheets were successfully compared");
            ComparisonWorkbookBase workbook = result.GetWorkbook();

            workbook.Save(filePath);
            Console.WriteLine("Results were successfully saved to a file");
            //result.GetWorkbook().SaveAsImages(imagePath);
            Console.WriteLine("Results were successfully saved to a bunch of images\n\n");
        }
Exemplo n.º 9
0
        public static void CompareTwoBigWorkbooks(ComparisonWorkbookBase source, ComparisonWorkbookBase target, string filePath
                                                  /*, string imagePath*/)
        {
            var settings = new CellsComparisonSettings();

            Console.WriteLine("Comparing two workbooks with big amount of worksheet and cells in there");
            Stopwatch watch = new Stopwatch();

            watch.Start();
            var result = source.CompareWith(target, settings);

            Console.WriteLine("Workbooks were successfully compared");
            result.GetWorkbook().Save(filePath);
            Console.WriteLine("Results were successfully saved to file");

            watch.Stop();
            Console.WriteLine("Compared for - " + watch.ElapsedMilliseconds + "milliseconds\n\n");
        }