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 提供的強大文件處理功能。