public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new ComparisonOptions
                {
                    SourceFile = new FileInfo
                    {
                        FilePath = "source_files/word/source.docx"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo {
                            FilePath = "target_files/word/target.docx"
                        }
                    }
                };

                var request = new PostChangesRequest(options);

                var changes = apiInstance.PostChanges(request);
                Console.WriteLine("Changes count: " + changes.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new ComparisonOptions
                {
                    SourceFile = new FileInfo
                    {
                        FilePath = "source_files/word/source_protected.docx",
                        Password = "******"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo
                        {
                            FilePath = "target_files/word/target_protected.docx",
                            Password = "******"
                        }
                    },
                    OutputPath = "output/result.docx"
                };

                var request = new ComparisonsRequest(options);

                var response = apiInstance.Comparisons(request);
                Console.WriteLine("Output file link: " + response.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public void ChangesText()
        {
            var options = GetComparisonOptions(TestFiles.SourceText, new List <TestFile> {
                TestFiles.TargetText
            });
            var response = CompareApi.PostChanges(new PostChangesRequest(options));

            Assert.AreEqual(6, response.Count);
        }
Example #4
0
        public void ComparisonsHtml()
        {
            var options = GetComparisonOptions(TestFiles.SourceHtml, new List <TestFile> {
                TestFiles.TargetHtml
            });
            var response = CompareApi.Comparisons(new ComparisonsRequest(options));

            Assert.AreEqual(response.Rel, options.OutputPath);
        }
        public void UpdatesImage()
        {
            var options = GetComparisonOptionsUpdates(TestFiles.SourceImage, new List <TestFile> {
                TestFiles.TargetImage
            });
            var response = CompareApi.PutChangesDocument(new PutChangesDocumentRequest(options));

            Assert.AreEqual(response.Rel, options.OutputPath);
        }
        public void ChangesImage()
        {
            var options = GetComparisonOptions(TestFiles.SourceImage, new List <TestFile> {
                TestFiles.TargetImage
            });
            var response = CompareApi.PostChanges(new PostChangesRequest(options));

            Assert.AreEqual(170, response.Count);
        }
Example #7
0
        public void UpdatesPdfPasswords()
        {
            var options = GetComparisonOptionsUpdates(TestFiles.SourcePdfProtected, new List <TestFile> {
                TestFiles.TargetPdfProtected
            });
            var response = CompareApi.PutChangesDocument(new PutChangesDocumentRequest(options));

            Assert.AreEqual(response.Rel, options.OutputPath);
        }
        public void ComparisonsSlidePasswords()
        {
            var options = GetComparisonOptions(TestFiles.SourceSlideProtected, new List <TestFile> {
                TestFiles.TargetSlideProtected
            });
            var response = CompareApi.Comparisons(new ComparisonsRequest(options));

            Assert.AreEqual(response.Rel, options.OutputPath);
        }
        public void ChangesDiagram()
        {
            var options = GetComparisonOptions(TestFiles.SourceDiagram, new List <TestFile> {
                TestFiles.TargetDiagram
            });
            var response = CompareApi.PostChanges(new PostChangesRequest(options));

            Assert.AreEqual(3, response.Count);
        }
Example #10
0
        public void ChangesPdfPasswords()
        {
            var options = GetComparisonOptions(TestFiles.SourcePdfProtected, new List <TestFile> {
                TestFiles.TargetPdfProtected
            });
            var response = CompareApi.PostChanges(new PostChangesRequest(options));

            Assert.AreEqual(3, response.Count);
        }
        public void ComparisonsSlideMulti()
        {
            var options = GetComparisonOptions(TestFiles.SourceSlide,
                                               new List <TestFile>
            {
                TestFiles.TargetSlide,
                TestFiles.TargetSlide1,
                TestFiles.TargetSlide2
            });
            var response = CompareApi.Comparisons(new ComparisonsRequest(options));

            Assert.AreEqual(response.Rel, options.OutputPath);
        }
        public void UpdatesWordMulti()
        {
            var options = GetComparisonOptionsUpdates(TestFiles.SourceWord,
                                                      new List <TestFile>()
            {
                TestFiles.TargetWord,
                TestFiles.TargetWord1,
                TestFiles.TargetWord2
            });
            var response = CompareApi.PutChangesDocument(new PutChangesDocumentRequest(options));

            Assert.AreEqual(response.Rel, options.OutputPath);
        }
        public void ChangesWordMultiPassword()
        {
            var options = GetComparisonOptions(TestFiles.SourceWordProtected,
                                               new List <TestFile>
            {
                TestFiles.TargetWordProtected,
                TestFiles.TargetWord1Protected,
                TestFiles.TargetWord2Protected
            });
            var response = CompareApi.PostChanges(new PostChangesRequest(options));

            Assert.AreEqual(32, response.Count);
        }
        public void ChangesSlideMulti()
        {
            var options = GetComparisonOptions(TestFiles.SourceSlide,
                                               new List <TestFile>
            {
                TestFiles.TargetSlide,
                TestFiles.TargetSlide1,
                TestFiles.TargetSlide2
            });
            var response = CompareApi.PostChanges(new PostChangesRequest(options));

            Assert.AreEqual(7, response.Count);
        }
        public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new ComparisonOptions
                {
                    SourceFile = new FileInfo
                    {
                        FilePath = "source_files/word/source.docx"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo {
                            FilePath = "target_files/word/target.docx"
                        }
                    },
                    Settings = new Settings {
                        InsertedItemsStyle = new ItemsStyle
                        {
                            HighlightColor = "14297642", // Red
                            FontColor      = "5102122",  // Green
                            Underline      = true,
                        },
                        DeletedItemsStyle = new ItemsStyle
                        {
                            FontColor = "14166746",
                            Bold      = true,
                        },
                        ChangedItemsStyle = new ItemsStyle
                        {
                            FontColor = "14320170",
                            Italic    = true,
                        },
                    },
                    OutputPath = "output/result.docx"
                };

                var request = new ComparisonsRequest(options);

                var response = apiInstance.Comparisons(request);
                Console.WriteLine("Output file link: " + response.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
Example #16
0
        public void BeforeAllTests()
        {
            var config = new Configuration(_appSid, _appKey)
            {
                ApiBaseUrl = _apiBaseUrl
            };

            CompareApi = new CompareApi(config);
            ReviewApi  = new ReviewApi(config);
            InfoApi    = new InfoApi(config);
            FileApi    = new FileApi(config);
            FolderApi  = new FolderApi(config);
            StorageApi = new StorageApi(config);

            UploadTestFiles();
        }
        public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new ComparisonOptions
                {
                    SourceFile = new FileInfo
                    {
                        FilePath = "source_files/word/source.docx"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo {
                            FilePath = "target_files/word/target.docx"
                        },
                        new FileInfo {
                            FilePath = "target_files/word/target_1.docx"
                        },
                        new FileInfo {
                            FilePath = "target_files/word/target_2.docx"
                        }
                    },
                    Settings = new Settings {
                        InsertedItemsStyle = new ItemsStyle
                        {
                            FontColor = "16711680"
                        }
                    },
                    OutputPath = "output/result.docx"
                };

                var request = new ComparisonsRequest(options);

                var response = apiInstance.Comparisons(request);
                Console.WriteLine("Output file link: " + response.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
Example #18
0
        public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new ComparisonOptions
                {
                    SourceFile = new FileInfo
                    {
                        FilePath = "source_files/word/source.docx"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo {
                            FilePath = "target_files/word/target.docx"
                        }
                    },
                    Settings = new Settings {
                        CloneMetadata = Settings.CloneMetadataEnum.FileAuthor,
                        MetaData      = new Metadata
                        {
                            Author     = "Tom",
                            Company    = "GroupDocs",
                            LastSaveBy = "Jack"
                        }
                    },
                    OutputPath = "output/result.docx"
                };

                var request = new ComparisonsRequest(options);

                var response = apiInstance.Comparisons(request);
                Console.WriteLine("Output file link: " + response.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new UpdatesOptions
                {
                    SourceFile = new FileInfo {
                        FilePath = "source_files/word/source.docx"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo {
                            FilePath = "target_files/word/target.docx"
                        }
                    },
                    OutputPath = "output/result.docx"
                };

                var changes = apiInstance.PostChanges(new PostChangesRequest(options));

                foreach (var change in changes)
                {
                    change.ComparisonAction = ChangeInfo.ComparisonActionEnum.Reject;
                }

                changes[0].ComparisonAction = ChangeInfo.ComparisonActionEnum.Accept;

                options.Changes = changes;

                var response = apiInstance.PutChangesDocument(new PutChangesDocumentRequest(options));

                Console.WriteLine("Output file link: " + response.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new CompareApi(Constants.GetConfig());

            try
            {
                var options = new ComparisonOptions
                {
                    SourceFile = new FileInfo
                    {
                        FilePath = "source_files/word/source.docx"
                    },
                    TargetFiles = new List <FileInfo> {
                        new FileInfo {
                            FilePath = "target_files/word/target.docx"
                        }
                    },
                    Settings = new Settings
                    {
                        CalculateComponentCoordinates = true
                    }
                };

                var request = new PostChangesRequest(options);

                var changes = apiInstance.PostChanges(request);
                foreach (var change in changes.Take(2))
                {
                    Console.WriteLine("Change Type: {0}, X: {1}, Y: {2}, Text: {3}", change.Type, change.Box.X, change.Box.Y, change.Text);
                }

                Console.WriteLine("...");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new CompareApi(Common.MyAppSid, Common.MyAppKey);

            try
            {
                var options = new UpdatesOptions()
                {
                    // Set source file
                    SourceFile = new FileInfo()
                    {
                        FilePath    = "Comparisondocs\\source_protected.docx",
                        Password    = "******",
                        StorageName = Common.MyStorage
                    },
                    OutputPath = "Comparisondocs\\result_single_protected.docx",
                    Settings   = new Settings
                    {
                        GenerateSummaryPage        = true,
                        ShowDeletedContent         = true,
                        StyleChangeDetection       = true,
                        UseFramesForDelInsElements = false,
                        MetaData                       = null,
                        DetailLevel                    = "Low",
                        DiagramMasterSetting           = null,
                        CalculateComponentCoordinates  = false,
                        CloneMetadata                  = "Default",
                        MarkDeletedInsertedContentDeep = false,
                        Password                       = "******",
                        PasswordSaveOption             = "User",
                        DeletedItemsStyle              = new ItemsStyle
                        {
                            BeginSeparatorString = "",
                            EndSeparatorString   = "",
                            FontColor            = "16711680",
                            HighlightColor       = "16711680",
                            Bold          = false,
                            Italic        = false,
                            StrikeThrough = false
                        },
                        InsertedItemsStyle = new ItemsStyle
                        {
                            BeginSeparatorString = "",
                            EndSeparatorString   = "",
                            FontColor            = "255",
                            HighlightColor       = "255",
                            Bold          = false,
                            Italic        = false,
                            StrikeThrough = false
                        },
                        StyleChangedItemsStyle = new ItemsStyle
                        {
                            BeginSeparatorString = "",
                            EndSeparatorString   = "",
                            FontColor            = "65280",
                            HighlightColor       = "65280",
                            Bold          = false,
                            Italic        = false,
                            StrikeThrough = false
                        },
                    },
                };

                // Set target file
                var      targets    = new List <FileInfo>();
                FileInfo targetFile = new FileInfo()
                {
                    FilePath    = "Comparisondocs\\target_protected.docx",
                    Password    = "******",
                    StorageName = Common.MyStorage
                };

                targets.Add(targetFile);
                options.TargetFiles = targets.ToList();

                // Accept or reject changes.
                var changes = new List <ChangeInfo>
                {
                    new ChangeInfo {
                        Id = 0, ComparisonAction = "Accept"
                    },
                    new ChangeInfo {
                        Id = 1, ComparisonAction = "Reject"
                    }
                };
                options.Changes = changes.ToList();

                // Create request object.
                var request = new PutChangesDocumentRequest(options);

                // Execute api method.
                var response = apiInstance.PutChangesDocument(request);

                Console.WriteLine("Expected response type is Link: " + response.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling Comparison CompareApi: " + e.Message);
            }
        }