Example #1
0
        public static void CompareTwoCreatingCells()
        {
            // Creating Cells
            IComparisonCell      sourceCell = new ComparisonCell();
            IComparisonParagraph paragraph  = sourceCell.AddParagraph();

            paragraph.AddRun("This is Cell of source table.");
            Console.WriteLine("New Column was created.");

            IComparisonCell targetCell = new ComparisonCell();

            paragraph = targetCell.AddParagraph();
            paragraph.AddRun("This is Cell of target table.");
            Console.WriteLine("New Column was created.");

            // Creating settings for comparison of Cells
            WordsComparisonSettings settings = new WordsComparisonSettings();
            // Comparing Cells
            IWordsCompareResult compareResult = sourceCell.CompareWith(targetCell, settings);

            Console.WriteLine("Cells was compared.");

            // Saving result of comparison to new document
            string resultPath          = @"./../../Components/testresult/CompareTwoCreatingCells/result.docx";
            IComparisonDocument result = compareResult.GetDocument();
            Stream resultStream        = new FileStream(resultPath, FileMode.Create);

            result.Save(resultStream, ComparisonSaveFormat.Docx);
            resultStream.Close();
            Console.WriteLine("Result of comparison was saved to document with the following source path" +
                              resultPath + ".");
            Console.WriteLine("===============================================");
            Console.WriteLine("");
        }
Example #2
0
        public static void CompareTwoCreatingCells()
        {
            // Creating cells
            ComparisonCellBase      sourceCell      = new ComparisonCell(200, 50, 0, 0);
            ComparisonParagraphBase sourceParagraph = new ComparisonParagraph();

            sourceCell.TextFrame.Paragraphs.Remove(sourceCell.TextFrame.Paragraphs[0]);
            sourceParagraph.Text = "This is source cell.";
            sourceCell.TextFrame.Paragraphs.Add(sourceParagraph);
            Console.WriteLine("New cell was created.");

            ComparisonCellBase      targetCell      = new ComparisonCell(200, 50, 0, 0);
            ComparisonParagraphBase targetParagraph = new ComparisonParagraph();

            targetCell.TextFrame.Paragraphs.Remove(targetCell.TextFrame.Paragraphs[0]);
            targetParagraph.Text = "This is target cell.";
            targetCell.TextFrame.Paragraphs.Add(targetParagraph);
            Console.WriteLine("New cell was created.");

            // Creating settings for comparison of cells
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing cells
            ISlidesCompareResult compareResult = sourceCell.CompareWith(targetCell, SlidesComparisonSettings);

            Console.WriteLine("Cells was compared.");

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTwoCreatingCells/result.pptx";
            ComparisonPresentationBase result = compareResult.GetPresentation();
            Stream resultStream = new FileStream(resultPath, FileMode.Create);

            result.Save(resultStream, ComparisonSaveFormat.Pptx);
            resultStream.Close();
            Console.WriteLine("Result of comparison was saved to presentation with the folloving source path" +
                              resultPath + ".");
            Console.WriteLine("===============================================");
            Console.WriteLine("");
        }