Exemple #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("");
        }
Exemple #2
0
        public static void CompareCellFromPresentationsWithCreatingCell()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareCellFromPresentationsWithCreatingCell.old.pptx";

            // Create to stream of presentation
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   sourceStream = assembly.GetManifestResourceStream(sourcePath);

            // Opening source presentation
            ComparisonPresentationBase sourcePresentation = new ComparisonPresentation(sourceStream);

            Console.WriteLine("Presentation with source path: " + sourcePath + " was loaded.");

            // Getting first cell from source presentation
            ComparisonCellBase sourceCell = (sourcePresentation.Slides[0].Shapes[0] as ComparisonTableBase)[0, 0];
            // Creating Cell
            ComparisonCellBase      targetCell = new ComparisonCell(200, 50, 0, 0);
            ComparisonParagraphBase paragraph  = new ComparisonParagraph();

            paragraph.Text = "This cell was created.";
            targetCell.TextFrame.Paragraphs.Remove(targetCell.TextFrame.Paragraphs[0]);
            targetCell.TextFrame.Paragraphs.Add(paragraph);
            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/CompareCellFromPresentationsWithCreatingCell/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("");
        }
Exemple #3
0
        public static void CompareCellFromDocumentWithCreatingCell()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Words.Components.data.CompareCellFromDocumentWithCreatingCell.source.docx";

            // Create to stream of document
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   sourceStream = assembly.GetManifestResourceStream(sourcePath);

            // Opening source document
            IComparisonDocument sourceDocument = new ComparisonDocument(sourceStream);

            Console.WriteLine("Document with source path: " + sourcePath + " was loaded.");

            // Getting first cell from source document
            IComparisonCell sourceCell = (sourceDocument.Sections[0].Body.GetChildNodes(ComparisonNodeType.Table, false)[0] as IComparisonTable).Rows[0].Cells[0];

            // Creating Cell
            IComparisonCell      targetCell = new ComparisonCell();
            IComparisonParagraph paragraph  = targetCell.AddParagraph();

            paragraph.AddRun("This is cell.");
            Console.WriteLine("New Cell 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/CompareCellFromDocumentWithCreatingCell/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("");
        }
Exemple #4
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("");
        }