public static void CompareTwoCreatingRows() { // Creating Rows ComparisonRowBase sourceRow = new ComparisonRow(new double[] { 200, 200 }, 50); ComparisonParagraphBase sourceParagraph0 = new ComparisonParagraph(); sourceParagraph0.Text = "This is first cell in source Row."; sourceRow[0].TextFrame.Paragraphs.Add(sourceParagraph0); ComparisonParagraphBase sourceParagraph1 = new ComparisonParagraph(); sourceParagraph1.Text = "This is second cell in source Row."; sourceRow[1].TextFrame.Paragraphs.Add(sourceParagraph1); Console.WriteLine("New Row was created."); ComparisonRowBase targetRow = new ComparisonRow(new double[] { 200, 200 }, 50); ComparisonParagraphBase targetParagraph0 = new ComparisonParagraph(); targetParagraph0.Text = "This is first cell in target Row."; targetRow[0].TextFrame.Paragraphs.Add(targetParagraph0); ComparisonParagraphBase targetParagraph1 = new ComparisonParagraph(); targetParagraph1.Text = "This is second cell in target Row."; targetRow[1].TextFrame.Paragraphs.Add(targetParagraph1); 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/CompareTwoCreatingRows/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 CompareTwoCreatingRows() { // Creating Rows IComparisonRow sourceRow = new ComparisonRow(new double[] { 100, 100 }, 20); IComparisonParagraph paragraph = sourceRow.Cells[0].AddParagraph(); paragraph.AddRun("This is cell."); paragraph = sourceRow.Cells[1].AddParagraph(); paragraph.AddRun("This is Cell of source table."); Console.WriteLine("New Row was created."); IComparisonRow targetRow = new ComparisonRow(new double[] { 100, 100 }, 20); paragraph = targetRow.Cells[0].AddParagraph(); paragraph.AddRun("This is cell."); paragraph = targetRow.Cells[1].AddParagraph(); paragraph.AddRun("This is Cell of target table."); Console.WriteLine("New Row was created."); // Creating settings for comparison of Rows WordsComparisonSettings settings = new WordsComparisonSettings(); // Comparing Rows IWordsCompareResult compareResult = sourceRow.CompareWith(targetRow, settings); Console.WriteLine("Rows was compared."); // Saving result of comparison to new document string resultPath = @"./../../Components/testresult/CompareTwoCreatingRows/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(""); }