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); } }
/// <summary> /// Compares source and target documents and returns a link to saved result /// </summary> /// <param name="request">Request. <see cref="ComparisonsRequest" /></param> /// <returns><see cref="Link"/></returns> public Link Comparisons(ComparisonsRequest request) { // verify the required parameter 'comparisonOptions' is set if (request.comparisonOptions == null) { throw new ApiException(400, "Missing required parameter 'comparisonOptions' when calling Comparisons"); } // create path and map variables var resourcePath = this.configuration.GetServerUrl() + "/comparison/comparisons"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); var postBody = SerializationHelper.Serialize(request.comparisonOptions); // http body (model) parameter var response = this.apiInvoker.InvokeApi( resourcePath, "POST", postBody, null, null); if (response != null) { return((Link)SerializationHelper.Deserialize(response, typeof(Link))); } return(null); }
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); } }
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); } }
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(Common.MyAppSid, Common.MyAppKey); try { var options = new Options() { // 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(); // Create request object. var request = new ComparisonsRequest(options); // Execute api method. var response = apiInstance.Comparisons(request); Console.WriteLine("Expected response type is Link: " + response.Href); } catch (Exception e) { Console.WriteLine("Exception while calling Comparison CompareApi: " + e.Message); } }