public static void CompareColumnsFromDifferentPresentations() { string sourcePath = @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareColumnsFromDifferentPresentations.old.pptx"; string targetPath = @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareColumnsFromDifferentPresentations.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 Column from source presentation ComparisonColumnBase sourceColumn = (sourcePresentation.Slides[0].Shapes[0] as ComparisonTableBase).Columns[0]; // Getting first Column from target presentation ComparisonColumnBase targetColumn = (targetPresentation.Slides[0].Shapes[0] as ComparisonTableBase).Columns[0]; // 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/CompareColumnsFromDifferentPresentations/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 CompareColumnFromPresentationsWithCreatingColumn() { string sourcePath = @"GroupDocs.Comparison.Samples.Slides.Components.data.CompareColumnFromPresentationsWithCreatingColumn.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]; // Creating Column ComparisonColumnBase targetColumn = new ComparisonColumn(new double[] { 50, 50 }, 200); targetColumn[0].TextFrame.Paragraphs[0].Text = "This is first cell in Column that was created."; targetColumn[1].TextFrame.Paragraphs[0].Text = "This is second cell in Column that was created."; 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/CompareColumnFromPresentationsWithCreatingColumn/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(""); }