GroupDocs 团队始终热情地为用户提供开箱即用的解决方案,在这方面,我们自豪地宣布首次发布下一代 GroupDocs.Comparison Cloud 17.12 REST API供公众使用。它是一个独立于平台的文档比较 REST API,可以与任何开发语言集成。我们的文档比较云 API 为文档比较操作提供了两个主要资源:更改和比较文档,它允许您获取更改数组或获取结果文档文件路径或流。此 API 可在您的应用程序中使用,以获得更好的用户体验和增强的性能。它支持所有主要的商业文档和图像格式,请点击此处了解更多详情。

功能 - GroupDocs.Comparison Cloud

GroupDocs.Comparison Cloud 是一个 REST API,用于比较几乎所有主要文档和图像格式,例如 Word、Cell、Html、PDF、PowerPoint 和图像。一些主要特点如下。您可以访问发行说明以获取完整的详细信息。

文档资源:

更改资源:

从比较文档中获取更改

您可以快速将该文档与相同格式的其他文档进行比较。以下是支持的格式的列表,请查看使用 GroupDocs.Comparison Cloud API 进行 DOCX 与 DOCX 比较的快速示例。

网址

 https://apireference.groupdocs.cloud/comparison/#!/Changes/PostChanges

请求正文

{'sourceFile':{'folder':'comparisons','name':'source.docx','password':''},'targetFiles':[{'folder':'comparisons','name':'target.docx','password':''}],'settings ':{'generateSummaryPage':true,'showDeletedContent':true,'styleChangeDetection':true,'insertedItemsStyle':{'color':'Blue','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'deletedItemsStyle':{'color':'Red','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'styleChangedItemsStyle':{'color':'Green','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'wordsSeparatorChars':[],'detailLevel':'Low','useFramesForDelInsElements':false,'calculateComponentCoordinates':false,'markDeletedInsertedContentDeep':false},'changes':[{'id':0,'action':'Reject'},{'id':1,'action':'Reject'}]}"

卷曲示例

curl -v "https://api.groupdocs.cloud/v1.0/comparison/compareDocuments/changes?appsid=XXXX&signature=XXX-XX"
-H "content-type: application/json"
-X POST -d "{'sourceFile':{'folder':'comparisons','name':'source.docx','password':''},'targetFiles':[{'folder':'comparisons','name':'target.docx','password':''}],'settings ':{'generateSummaryPage':true,'showDeletedContent':true,'styleChangeDetection':true,'insertedItemsStyle':{'color':'Blue','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'deletedItemsStyle':{'color':'Red','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'styleChangedItemsStyle':{'color':'Green','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'wordsSeparatorChars':[],'detailLevel':'Low','useFramesForDelInsElements':false,'calculateComponentCoordinates':false,'markDeletedInsertedContentDeep':false},'changes':[{'id':0,'action':'Reject'},{'id':1,'action':'Reject'}]}"

GoupDocs.Comparison Cloud API .NET SDK 示例

 var configuration = new Configuration

{
    AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
};
// Initiate API object
var apiInstance = new ChangesApi(configuration);
try
{
    // Comparison Request
    ComparisonRequest comparisonRequest = new ComparisonRequest()
    {
        // Comparison Request Settings
        Settings = new ComparisonRequestSettings()
        {
            GenerateSummaryPage = true,
            ShowDeletedContent = true,
            StyleChangeDetection = true,
            UseFramesForDelInsElements = false,
            DetailLevel = "Low",
            DeletedItemsStyle = new StyleSettingsValues()
            {
                BeginSeparatorString = "",
                EndSeparatorString = "",
                Color = new Color().Red
            },
            InsertedItemsStyle = new StyleSettingsValues()
            {
               BeginSeparatorString = "",
                EndSeparatorString = "",
               Color = new Color().Blue
            },
            StyleChangedItemsStyle = new StyleSettingsValues()
            {
               BeginSeparatorString = "",
               EndSeparatorString = "",
                Color = new Color().Green
            },
            CalculateComponentCoordinates = false,
            CloneMetadata = "Source",
            MarkDeletedInsertedContentDeep = false,
            MetaData = new ComparisonMetadataValues()
          {
                Author = "GroupDocs",
                Company = "GroupDocs",
                LastSaveBy = "GroupDocs"
          },
            Password = "",
            PasswordSaveOption = ""

        },
        // Source file
        SourceFile = new ComparisonFileInfo()
        {
           Folder = "comparisons",
            Name = "source.docx",
            Password = ""
        }
    };

    List targets = new List();
    // Target file
    targets.Add(new ComparisonFileInfo()
    {
        Folder = "comparisons",
        Name = "target.docx",
        Password = ""
    });
    // Target file - single or multiple target files are allowed.
   comparisonRequest.TargetFiles = targets.ToArray();

    // Accept or Reject changes
    comparisonRequest.Changes = new List();
    comparisonRequest.Changes.Add(new ComparisonChange() { Id = 0, Action = "Accept" });
    comparisonRequest.Changes.Add(new ComparisonChange() { Id = 1, Action = "Reject" });

    // API call for response.

    var response = apiInstance.PostChanges(new Model.Requests.PostChangesRequest() { Request =    comparisonRequest });

    Console.WriteLine(string.Format("{0}: {1}", "response is List", response.Count.ToString()));
}
catch (Exception e)
{
    Console.WriteLine("Exception when calling ChangesApi.PostChanges: " + e.Message);
}

获取文档资源

您可以通过在请求正文中提供 JsonRequest Object 数据来比较文档并获取结果文档路径。以下 GroupDocs.Comparison Cloud REST API 示例可用于获取结果文档路径。

网址

 [`https://apireference.groupdocs.cloud/comparison/#!/Comparison/Comparison`](https://apireference.groupdocs.cloud/comparison/#!/Comparison/Comparison)

请求正文

{'sourceFile':{'folder':'comparisons','name':'source.docx','password':''},'targetFiles':[{'folder':'comparisons','name':'target.docx','password':''}],'settings ':{'generateSummaryPage':true,'showDeletedContent':true,'styleChangeDetection':true,'insertedItemsStyle':{'color':'Blue','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'deletedItemsStyle':{'color':'Red','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'styleChangedItemsStyle':{'color':'Green','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'wordsSeparatorChars':[],'detailLevel':'Low','useFramesForDelInsElements':false,'calculateComponentCoordinates':false,'markDeletedInsertedContentDeep':false},'changes':[{'id':0,'action':'Reject'},{'id':1,'action':'Reject'}]}"

卷曲示例

curl -v  "https://api.groupdocs.cloud/v1.0/comparison/compareDocuments?outPath=comparisons%2Fcomparedoutput.docx&appsid=XXXX&signature=XXX-XX" 
-H "Content-Type: application/json"
-X POST -d  "{'sourceFile':{'folder':'comparisons','name':'source.docx','password':''},'targetFiles':[{'folder':'comparisons','name':'target.docx','password':''}],'settings
  ':{'generateSummaryPage':true,'showDeletedContent':true,'styleChangeDetection':true,'insertedItemsStyle':{'color':'Blue','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'deletedItemsStyle':{'color':'Red','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'styleChangedItemsStyle':{'color':'Green','beginSeparatorString':'','endSeparatorString':'','bold':false,'italic':false,'strikeThrough':false},'wordsSeparatorChars':[],'detailLevel':'Low','useFramesForDelInsElements':false,'calculateComponentCoordinates':false,'markDeletedInsertedContentDeep':false},'changes':[{'id':0,'action':'Reject'},{'id':1,'action':'Reject'}]}"

GoupDocs.Comparison Cloud API .NET SDK 示例

 var configuration = new Configuration
{
    AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
};

// Initiate API object
var apiInstance = new ComparisonApi(configuration);

try
{
    // Comparison Request
    ComparisonRequest comparisonRequest = new ComparisonRequest()
    {
        // Comparison Request Settings
        Settings = new ComparisonRequestSettings()
        {
            GenerateSummaryPage = true,
            ShowDeletedContent = true,
            StyleChangeDetection = true,
            UseFramesForDelInsElements = false,
            DetailLevel = "Low",
            DeletedItemsStyle = new StyleSettingsValues()
            {
                BeginSeparatorString = "",
                EndSeparatorString = "",
                Color = new Color().Red
            },
            InsertedItemsStyle = new StyleSettingsValues()
            {
                BeginSeparatorString = "",
                EndSeparatorString = "",
                Color = new Color().Blue
            },
            StyleChangedItemsStyle = new StyleSettingsValues()
            {
                BeginSeparatorString = "",
                EndSeparatorString = "",
                Color = new Color().Green
            },
            CalculateComponentCoordinates = false,
            CloneMetadata = "Source",
            MarkDeletedInsertedContentDeep = false,
            MetaData = new ComparisonMetadataValues()
            {
                Author = "GroupDocs",
                Company = "GroupDocs",
                LastSaveBy = "GroupDocs"
            },
            Password = "",
            PasswordSaveOption = ""
        },
        // Source file
        SourceFile = new ComparisonFileInfo()
        {
            Folder = "comparisons",
            Name = "source.docx",
            Password = ""
        }
    };

    List targets = new List();
    // Target file
    targets.Add(new ComparisonFileInfo()
    {
        Folder = "comparisons",
        Name = "target.docx",
        Password = ""
    });
    // Target file - single or multiple target files are allowed.
    comparisonRequest.TargetFiles = targets.ToArray();

    // API call for response.
    var response = apiInstance.Comparison(new Model.Requests.ComparisonRequest() { Request = comparisonRequest, OutPath = "comparisons/compare-result.docx" });

    Console.WriteLine(string.Format("{0}: {1}", "response is Link", response.Href.ToString()));
}
catch (Exception e)
{
    Console.WriteLine("Exception when calling ComparisonApi.Comparison: " + e.Message);
}

API浏览器

GroupDocs Cloud 提供了一个 Web API 浏览器,可以立即在您的浏览器中试用我们的 API。它是 GroupDocs Cloud API 的 Swagger 文档集合。使用Web API资源管理器,您可以获取有关API中所有资源的信息。它还为我们的 API 端点文档提供测试和交互。请点击此处了解更多详情。

SDKsGroupDocs.比较

Cloud API 提供 SDK,以便在您最喜欢的平台(例如 .NET)中使用其功能。 SDK 与工作示例一起托管在我们的 GitHub 存储库中,可让您立即开始使用。

GroupDocs.比较

云 API 资源您可以访问以下 API 资源以开始使用该 API。

立即开始免费试用

立即开始免费试用 – 您只需注册 GroupDocs 云服务。注册后,您就可以尝试 GroupDocs Cloud 提供的强大文件处理功能。