製品を閲覧する

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Product Docs Swagger Examples Blog Support Dashboard

インストール

パッケージは、availablePyPI にあり、経由でインストールできますpip次のコマンドを実行します。

pip install groupdocs-comparison-cloud

PyPI - Version PyPI - Downloads Python-GroupDocsCloud


要件

  • Python 2.7 または 3.4+
  • pip パッケージマネージャー
  • GroupDocs クラウド認証情報Client ID and Client Secretダッシュボードから

依存関係

SDK は次のパッケージを自動的にインストールします。

パッケージ制約
urllib3>= 1.15
six>= 1.10
certifi
python-dateutil

クイックスタート

API 認証情報を取得する

GroupDocs.Comparison Cloud を使用するには、次の URL でサインアップしてください。GroupDocs.Cloud Dashboardクライアント IDクライアント シークレット を取得します。

API を初期化する

GroupDocs.Comparison Cloud SDK for Python の使用を開始するには、次のコードを使用します。

import groupdocs_comparison_cloud

# Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"

# Create API configuration
configuration = groupdocs_comparison_cloud.Configuration(client_id, client_secret)
configuration.api_base_url = "https://api.groupdocs.cloud"

# Create instance of the Compare API
compare_api = groupdocs_comparison_cloud.CompareApi.from_config(configuration)

2 つの文書を比較する

初期化したら、次の基本的な例を使用して Word 文書を比較し、結果を保存します。

import groupdocs_comparison_cloud

compare_api = groupdocs_comparison_cloud.CompareApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source.docx"
target = groupdocs_comparison_cloud.FileInfo()
target.file_path = "target_files/word/target.docx"
options = groupdocs_comparison_cloud.ComparisonOptions()
options.source_file = source
options.target_files = [target]
options.output_path = "output/result.docx"

response = compare_api.comparisons(groupdocs_comparison_cloud.ComparisonsRequest(options))

print("Output file link: " + response.href)

このクイック スタート ガイドを使用すると、Python アプリケーションで GroupDocs.Comparison Cloud を使用してドキュメントの比較を開始する準備が整います。詳細については、次のサイトを参照してください。documentation.

サポートされているファイル形式を取得する

Comparison API を通じて利用可能な、サポートされているファイル形式の完全なリストを取得します。

import groupdocs_comparison_cloud

info_api = groupdocs_comparison_cloud.InfoApi.from_keys("YourClientId", "YourClientSecret")

result = info_api.get_supported_file_formats()

print("Formats count: " + str(len(result.formats)))

PDF ドキュメントを比較する

2 つの PDF ドキュメントを比較し、追跡された変更を強調表示して結果を保存します。

import groupdocs_comparison_cloud

compare_api = groupdocs_comparison_cloud.CompareApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/pdf/source.pdf"
target = groupdocs_comparison_cloud.FileInfo()
target.file_path = "target_files/pdf/target.pdf"
options = groupdocs_comparison_cloud.ComparisonOptions()
options.source_file = source
options.target_files = [target]
options.output_path = "output/result.pdf"

response = compare_api.comparisons(groupdocs_comparison_cloud.ComparisonsRequest(options))

print("Output file link: " + response.href)

パスワードで保護されたドキュメントを比較する

各ファイルの資格情報を指定して、パスワードで保護された 2 つの Word 文書を比較します。

import groupdocs_comparison_cloud

compare_api = groupdocs_comparison_cloud.CompareApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source_protected.docx"
source.password = "1231"
target = groupdocs_comparison_cloud.FileInfo()
target.file_path = "target_files/word/target_protected.docx"
target.password = "5784"
options = groupdocs_comparison_cloud.ComparisonOptions()
options.source_file = source
options.target_files = [target]
options.output_path = "output/result.docx"

response = compare_api.comparisons(groupdocs_comparison_cloud.ComparisonsRequest(options))

print("Output file link: " + response.href)

変更リストの取得

ソースドキュメントとターゲットドキュメント間で検出されたすべての変更の詳細なリストを取得します。

import groupdocs_comparison_cloud

compare_api = groupdocs_comparison_cloud.CompareApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source.docx"
target = groupdocs_comparison_cloud.FileInfo()
target.file_path = "target_files/word/target.docx"
options = groupdocs_comparison_cloud.ComparisonOptions()
options.source_file = source
options.target_files = [target]
options.output_path = "output/result.docx"

changes = compare_api.post_changes(groupdocs_comparison_cloud.PostChangesRequest(options))

print("Changes count: " + str(len(changes)))

変更を受け入れるか拒否する

ドキュメントを比較した後、個々の変更を承認または拒否し、更新された結果を保存します。

import groupdocs_comparison_cloud

compare_api = groupdocs_comparison_cloud.CompareApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source.docx"
target = groupdocs_comparison_cloud.FileInfo()
target.file_path = "target_files/word/target.docx"
options = groupdocs_comparison_cloud.UpdatesOptions()
options.source_file = source
options.target_files = [target]
options.output_path = "output/result.docx"

changes = compare_api.post_changes(groupdocs_comparison_cloud.PostChangesRequest(options))

for change in changes:
    change.comparison_action = "Reject"
changes[0].comparison_action = "Accept"

options.changes = changes

response = compare_api.put_changes_document(groupdocs_comparison_cloud.PutChangesDocumentRequest(options))

print("Output file link: " + response.href)

オプションを使用して複数のドキュメントを比較

ソースドキュメントを複数のターゲットと比較し、挿入されたアイテムの外観をカスタマイズします。

import groupdocs_comparison_cloud

compare_api = groupdocs_comparison_cloud.CompareApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source.docx"
target = groupdocs_comparison_cloud.FileInfo()
target.file_path = "target_files/word/target.docx"
target1 = groupdocs_comparison_cloud.FileInfo()
target1.file_path = "target_files/word/target_1.docx"
target2 = groupdocs_comparison_cloud.FileInfo()
target2.file_path = "target_files/word/target_2.docx"
options = groupdocs_comparison_cloud.ComparisonOptions()
options.source_file = source
options.target_files = [target, target1, target2]
options.output_path = "output/result.docx"
settings = groupdocs_comparison_cloud.Settings()
settings.inserted_items_style = groupdocs_comparison_cloud.ItemsStyle()
settings.inserted_items_style.font_color = "16711680"
options.settings = settings

response = compare_api.comparisons(groupdocs_comparison_cloud.ComparisonsRequest(options))

print("Output file link: " + response.href)

DOCX ドキュメントにリビジョンを適用する

Word 文書内の追跡されたリビジョンをプログラムで承認または拒否します。

import groupdocs_comparison_cloud

review_api = groupdocs_comparison_cloud.ReviewApi.from_keys("YourClientId", "YourClientSecret")

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source_with_revs.docx"
options = groupdocs_comparison_cloud.ApplyRevisionsOptions()
options.source_file = source
options.output_path = "output/result.docx"

revisions = review_api.get_revisions(groupdocs_comparison_cloud.GetRevisionsRequest(source))

for revision in revisions:
    revision.action = "Accept"

options.revisions = revisions

response = review_api.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options))

print("Output file link: " + response.href)

GitHub のサンプル プロジェクト

GroupDocs.Comparison Cloud Python Samplesリポジトリには、以下をカバーするすぐに実行できるサンプルが含まれています。

カテゴリー
基本的な使い方サポートされている形式、ドキュメント情報、ドキュメントの比較、PDF ドキュメントの比較、ドキュメントのプレビュー
高度な使用法 — 複数ドキュメントの比較オプションを使用して複数のドキュメントを比較、複数の保護されたドキュメントを比較
高度な使用法 — 改訂版リビジョンのリストを取得する、リビジョンを適用する、すべてのリビジョンを受け入れる、すべてのリビジョンを拒否する
高度な使用法 — 保存オプションメタデータの設定、保存時のパスワードの設定
高度な使用法 — 変更制御変更の承認または拒否、保護されたドキュメントの比較、機密性の比較、変更スタイルのカスタマイズ、変更座標の取得、変更リストの取得

サンプルの実行方法

  1. クローンを作成するか、ダウンロードします。samples repository2.編集Examples/RunExamples.pyそしてあなたの設定をclient_idそしてclient_secret3. に移動します。Examplesディレクトリ
  2. 走るpip install groupdocs-comparison-cloud -U5. 実行python RunExamples.py

詳細については、次のサイトをご覧ください。Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


タグ

Document Comparison API | Python Cloud API | GroupDocs.Comparison Cloud | REST API | Document Comparison | Folder Comparison | Revision Control | Track Changes | Preview Generation | Multi-format Support | Password Protected Documents | Source Code Comparison | Change Tracking | Customization | Document Merging | Change Coordinates | Metadata Extraction | Document Security | Document Review | Secure API Access | Cloud Storage Integration | Cross-platform API


 日本