private static void Compare(string sourcePath, string targetPath, string resultPath,
                                    SlidesComparisonSettings SlidesComparisonSettings)
        {
            // Create to streams of presentations
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   sourceStream = assembly.GetManifestResourceStream(sourcePath);
            Stream   targetStream = assembly.GetManifestResourceStream(targetPath);
            // Opening two presentations
            ComparisonPresentationBase sourcePresentation = new ComparisonPresentation(sourceStream);

            Console.WriteLine("Presentation with source path: " + sourcePath + " was loaded.");
            ComparisonPresentationBase targetPresentation = new ComparisonPresentation(targetStream);

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

            // Comparing presentations
            ISlidesCompareResult compareResult = sourcePresentation.CompareWith(targetPresentation, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            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("");
        }
Ejemplo n.º 2
0
        public static void CompareTwoCreatingTables()
        {
            // Creating Tables
            ComparisonTableBase     sourceTable       = new ComparisonTable(100, 100, new double[] { 200, 200 }, new double[] { 50, 50 });
            ComparisonParagraphBase sourceParagraph00 = new ComparisonParagraph();

            sourceParagraph00.Text = "This is first cell in source table.";
            sourceTable[0, 0].TextFrame.Paragraphs.Add(sourceParagraph00);
            ComparisonParagraphBase sourceParagraph01 = new ComparisonParagraph();

            sourceParagraph01.Text = "This is second cell in source table.";
            sourceTable[0, 1].TextFrame.Paragraphs.Add(sourceParagraph01);
            ComparisonParagraphBase sourceParagraph10 = new ComparisonParagraph();

            sourceParagraph10.Text = "This is third cell in source table.";
            sourceTable[1, 0].TextFrame.Paragraphs.Add(sourceParagraph10);
            ComparisonParagraphBase sourceParagraph11 = new ComparisonParagraph();

            sourceParagraph11.Text = "This is fourth cell in source table.";
            sourceTable[1, 1].TextFrame.Paragraphs.Add(sourceParagraph11);
            Console.WriteLine("New Table was created.");

            ComparisonTableBase     targetTable       = new ComparisonTable(100, 100, new double[] { 200, 200 }, new double[] { 50, 50 });
            ComparisonParagraphBase targetParagraph00 = new ComparisonParagraph();

            targetParagraph00.Text = "This is first cell in target table.";
            targetTable[0, 0].TextFrame.Paragraphs.Add(targetParagraph00);
            ComparisonParagraphBase targetParagraph01 = new ComparisonParagraph();

            targetParagraph01.Text = "This is second cell in target table.";
            targetTable[0, 1].TextFrame.Paragraphs.Add(targetParagraph01);
            ComparisonParagraphBase targetParagraph10 = new ComparisonParagraph();

            targetParagraph10.Text = "This is third cell in target table.";
            targetTable[1, 0].TextFrame.Paragraphs.Add(targetParagraph10);
            ComparisonParagraphBase targetParagraph11 = new ComparisonParagraph();

            targetParagraph11.Text = "This is fourth cell in target table.";
            targetTable[1, 1].TextFrame.Paragraphs.Add(targetParagraph11);
            Console.WriteLine("New Table was created.");

            // Creating settings for comparison of Tables
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Tables
            ISlidesCompareResult compareResult = sourceTable.CompareWith(targetTable, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTwoCreatingTables/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("");
        }
        public static void CompareTwoCreatingParagraphs()
        {
            // Creating Paragraphs
            ComparisonParagraphBase sourceParagraph = new ComparisonParagraph();

            sourceParagraph.Text = "This is source Paragraph.";
            Console.WriteLine("New Paragraph was created.");

            ComparisonParagraphBase targetParagraph = new ComparisonParagraph();

            targetParagraph.Text = "This is target Paragraph.";
            Console.WriteLine("New Paragraph was created.");

            // Creating settings for comparison of Paragraphs
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Paragraphs
            ISlidesCompareResult compareResult = sourceParagraph.CompareWith(targetParagraph, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTwoCreatingParagraphs/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("");
        }
Ejemplo n.º 4
0
        public static void CompareRowFromPresentationsWithCreatingRow()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareRowFromPresentationsWithCreatingRow.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 Row from source presentation
            ComparisonRowBase sourceRow = (sourcePresentation.Slides[0].Shapes[0] as ComparisonTableBase).Rows[0];
            // Creating Row
            ComparisonRowBase       targetRow  = new ComparisonRow(new double[] { 200, 200 }, 50);
            ComparisonParagraphBase paragraph0 = new ComparisonParagraph();

            paragraph0.Text = "This is first cell in Row that was created.";
            targetRow[0].TextFrame.Paragraphs.Add(paragraph0);
            ComparisonParagraphBase paragraph1 = new ComparisonParagraph();

            paragraph1.Text = "This is second cell in Row that was created.";
            targetRow[1].TextFrame.Paragraphs.Add(paragraph1);
            Console.WriteLine("New Row was created.");

            // Creating settings for comparison of Rows
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Rows
            ISlidesCompareResult compareResult = sourceRow.CompareWith(targetRow, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareRowFromPresentationsWithCreatingRow/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("");
        }
        public static void CompareParagraphsFromDifferentPresentations()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareParagraphsFromDifferentPresentations.old.pptx";
            string targetPath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareParagraphsFromDifferentPresentations.new.pptx";

            // Create to streams of presentations
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   sourceStream = assembly.GetManifestResourceStream(sourcePath);
            Stream   targetStream = assembly.GetManifestResourceStream(targetPath);

            // Opening two presentations
            ComparisonPresentationBase sourcePresentation = new ComparisonPresentation(sourceStream);

            Console.WriteLine("Presentation with source path: " + sourcePath + " was loaded.");
            ComparisonPresentationBase targetPresentation = new ComparisonPresentation(targetStream);

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

            // Getting first Paragraph from source presentation
            ComparisonParagraphBase sourceParagraph =
                (sourcePresentation.Slides[0].Shapes[0] as ComparisonAutoShapeBase).TextFrame.Paragraphs[0];
            // Getting first Paragraph from target presentation
            ComparisonParagraphBase targetParagraph =
                (targetPresentation.Slides[0].Shapes[0] as ComparisonAutoShapeBase).TextFrame.Paragraphs[0];

            // Creating settings for comparison of Paragraphs
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Paragraphs
            ISlidesCompareResult compareResult = sourceParagraph.CompareWith(targetParagraph, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareParagraphsFromDifferentPresentations/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("");
        }
        public static void CompareSlideFromPresentationsWithCreatingSlide()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareSlideFromPresentationsWithCreatingSlide.old.pptx";

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

            // Opening two presentations
            ComparisonPresentationBase sourcePresentation = new ComparisonPresentation(sourceStream);

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

            // Getting first slide from source presentation
            ComparisonSlideBase sourceSlide = sourcePresentation.Slides[0];
            // Creating Slide
            ComparisonSlideBase     targetSlide = new ComparisonSlide();
            ComparisonAutoShapeBase autoShape   = targetSlide.Shapes.AddAutoShape(ComparisonShapeType.Rectangle, 100, 100, 500, 300);
            ComparisonParagraphBase paragraph   = new ComparisonParagraph();

            paragraph.Text = "Contrary to popular belief, Lorem Ipsum is not simply random text. It has" +
                             " roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard " +
                             "McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure";
            autoShape.TextFrame.Paragraphs.Add(paragraph);
            Console.WriteLine("New slide was created.");

            // Creating settings for comparison of slides
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing slides
            ISlidesCompareResult compareResult = sourceSlide.CompareWith(targetSlide, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareSlideFromPresentationsWithCreatingSlide/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("");
        }
        public static void CompareAutoShapeFromPresentationsWithCreatingAutoShape()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareAutoShapeFromPresentationsWithCreatingAutoShape.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 AutoShape from source presentation
            ComparisonAutoShapeBase sourceAutoShape = (sourcePresentation.Slides[0].Shapes[0] as ComparisonAutoShapeBase);
            // Creating AutoShape
            ComparisonAutoShapeBase targetAutoShape = new ComparisonAutoShape(100, 100, 500, 300);
            ComparisonParagraphBase paragraph       = new ComparisonParagraph();

            paragraph.Text = "This AutoShape was created.";
            targetAutoShape.AddTextFrame("");
            targetAutoShape.TextFrame.Paragraphs.Add(paragraph);
            Console.WriteLine("New AutoShape was created.");

            // Creating settings for comparison of AutoShapes
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing AutoShapes
            ISlidesCompareResult compareResult = sourceAutoShape.CompareWith(targetAutoShape, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath =
                @"./../../Components/testresult/CompareAutoShapeFromPresentationsWithCreatingAutoShape/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("");
        }
        public static void CompareTwoCreatingColumns()
        {
            // Creating Columns
            ComparisonColumnBase    sourceColumn     = new ComparisonColumn(new double[] { 50, 50 }, 200);
            ComparisonParagraphBase sourceParagraph0 = new ComparisonParagraph();

            sourceParagraph0.Text = "This is first cell in source Column.";
            sourceColumn[0].TextFrame.Paragraphs.Add(sourceParagraph0);
            ComparisonParagraphBase sourceParagraph1 = new ComparisonParagraph();

            sourceParagraph1.Text = "This is second cell in source Column.";
            sourceColumn[1].TextFrame.Paragraphs.Add(sourceParagraph1);
            Console.WriteLine("New Column was created.");

            ComparisonColumnBase    targetColumn     = new ComparisonColumn(new double[] { 50, 50 }, 200);
            ComparisonParagraphBase targetParagraph0 = new ComparisonParagraph();

            targetParagraph0.Text = "This is first cell in target Column.";
            targetColumn[0].TextFrame.Paragraphs.Add(targetParagraph0);
            ComparisonParagraphBase targetParagraph1 = new ComparisonParagraph();

            targetParagraph1.Text = "This is second cell in target Column.";
            targetColumn[1].TextFrame.Paragraphs.Add(targetParagraph1);
            Console.WriteLine("New Column was created.");

            // Creating settings for comparison of Columns
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Columns
            ISlidesCompareResult compareResult = sourceColumn.CompareWith(targetColumn, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTwoCreatingColumns/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("");
        }
Ejemplo n.º 9
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("");
        }
Ejemplo n.º 10
0
        public static void CompareTableFromPresentationsWithCreatingTable()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareTableFromPresentationsWithCreatingTable.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 Table from source presentation
            ComparisonTableBase sourceTable = (sourcePresentation.Slides[0].Shapes[0] as ComparisonTableBase);
            // Creating Table
            ComparisonTableBase targetTable = new ComparisonTable(100, 100, new double[] { 200, 200 }, new double[] { 50, 50 });

            targetTable[0, 0].TextFrame.Paragraphs[0].Text = "This is first cell in created table.";
            targetTable[0, 1].TextFrame.Paragraphs[0].Text = "This is second cell in created table.";
            targetTable[1, 0].TextFrame.Paragraphs[0].Text = "This is third cell in created table.";
            targetTable[1, 1].TextFrame.Paragraphs[0].Text = "This is fourth cell in created table.";
            Console.WriteLine("New Table was created.");

            // Creating settings for comparison of Tables
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Tables
            ISlidesCompareResult compareResult = sourceTable.CompareWith(targetTable, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTableFromPresentationsWithCreatingTable/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("");
        }
        public static void CompareTwoCreatingSlides()
        {
            // Creating Slides
            ComparisonSlideBase     sourceSlide     = new ComparisonSlide();
            ComparisonAutoShapeBase sourceAutoShape = sourceSlide.Shapes.AddAutoShape(ComparisonShapeType.Rectangle, 100, 100, 500,
                                                                                      300);
            ComparisonParagraphBase sourceParagraph = new ComparisonParagraph();

            sourceParagraph.Text = "Contrary to popular belief, Lorem Ipsum is not simply random text. It has" +
                                   " roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard " +
                                   "McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure";
            sourceAutoShape.TextFrame.Paragraphs.Add(sourceParagraph);
            Console.WriteLine("New slide was created.");

            ComparisonSlideBase     targetSlide     = new ComparisonSlide();
            ComparisonAutoShapeBase targetAutoShape = targetSlide.Shapes.AddAutoShape(ComparisonShapeType.Rectangle, 100, 100, 500,
                                                                                      300);
            ComparisonParagraphBase targetParagraph = new ComparisonParagraph();

            targetParagraph.Text = "Contrary to popular belief, the Lorem Ipsum is not simply random text. Richard " +
                                   "McClintock, a Latin professor at Hampden-Sydney in Virginia, looked up one of the more obscure";
            targetAutoShape.TextFrame.Paragraphs.Add(targetParagraph);
            Console.WriteLine("New slide was created.");

            // Creating settings for comparison of slides
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing slides
            ISlidesCompareResult compareResult = sourceSlide.CompareWith(targetSlide, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTwoCreatingSlides/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("");
        }
        public static void CompareTwoCreatingAutoShapes()
        {
            // Creating AutoShapes
            ComparisonAutoShapeBase sourceAutoShape = new ComparisonAutoShape(100, 100, 500, 300);
            ComparisonParagraphBase sourceParagraph = new ComparisonParagraph();

            sourceParagraph.Text = "This is source AutoShape.";
            sourceAutoShape.AddTextFrame("");
            sourceAutoShape.TextFrame.Paragraphs.Add(sourceParagraph);
            Console.WriteLine("New AutoShape was created.");

            ComparisonAutoShapeBase targetAutoShape = new ComparisonAutoShape(100, 100, 500, 300);
            ComparisonParagraphBase targetParagraph = new ComparisonParagraph();

            targetParagraph.Text = "This is target AutoShape.";
            targetAutoShape.AddTextFrame("");
            targetAutoShape.TextFrame.Paragraphs.Add(targetParagraph);
            Console.WriteLine("New AutoShape was created.");

            // Creating settings for comparison of AutoShapes
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing AutoShapes
            ISlidesCompareResult compareResult = sourceAutoShape.CompareWith(targetAutoShape, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareTwoCreatingAutoShapes/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("");
        }
        public static void CompareColumnsFromOnePresentations()
        {
            string sourcePath =
                @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareColumnsFromOnePresentations.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 Column from source presentation
            ComparisonColumnBase sourceColumn = (sourcePresentation.Slides[0].Shapes[0] as ComparisonTableBase).Columns[0];
            // Getting second Column from source presentation
            ComparisonColumnBase targetColumn = (sourcePresentation.Slides[0].Shapes[0] as ComparisonTableBase).Columns[1];

            // Creating settings for comparison of Columns
            SlidesComparisonSettings SlidesComparisonSettings = new SlidesComparisonSettings();
            // Comparing Columns
            ISlidesCompareResult compareResult = sourceColumn.CompareWith(targetColumn, SlidesComparisonSettings);

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

            // Saving result of comparison to new presentation
            string resultPath = @"./../../Components/testresult/CompareColumnsFromOnePresentations/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("");
        }
Ejemplo n.º 14
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("");
        }