製品を閲覧する

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-assembly-cloud

PyPI - Version PyPI - Downloads Python-GroupDocsCloud


要件

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

依存関係

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

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

クイックスタート

API 認証情報を取得する

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

API を初期化する

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

import groupdocsassemblycloud

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

# Create instance of the Assembly API
assembly_api = groupdocsassemblycloud.AssemblyApi(client_id, client_secret)
assembly_api.api_client.configuration.host = "https://api.groupdocs.cloud"

テンプレートと JSON データからドキュメントを組み立てる

初期化したら、次の基本的な例を使用して、テンプレートと JSON データ ソースからドキュメントを生成します。

import groupdocsassemblycloud
from groupdocsassemblycloud.models import requests

client_id = "YourClientId"
client_secret = "YourClientSecret"

assembly_api = groupdocsassemblycloud.AssemblyApi(client_id, client_secret)
assembly_api.api_client.configuration.host = "https://api.groupdocs.cloud"

# Upload the template file to cloud storage
with open("template.docx", "rb") as template_file:
    upload_request = requests.UploadFileRequest(template_file, path="template.docx")
    assembly_api.upload_file(upload_request)

# Read JSON data source
with open("data.json") as f:
    data = f.read()

template_file_info = groupdocsassemblycloud.TemplateFileInfo("template.docx")
options = groupdocsassemblycloud.AssembleOptions(template_file_info, save_format="docx", report_data=data)
request = requests.AssembleDocumentRequest(options)
result = assembly_api.assemble_document(request)

print("Generated document size = " + str(len(result)))

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

ドキュメントを PDF に組み立てる

OpenDocument テンプレートと JSON データから PDF レポートを生成します。

import groupdocsassemblycloud
from groupdocsassemblycloud.models import requests

client_id = "YourClientId"
client_secret = "YourClientSecret"

assembly_api = groupdocsassemblycloud.AssemblyApi(client_id, client_secret)
assembly_api.api_client.configuration.host = "https://api.groupdocs.cloud"

filename = "TableFeatures.odt"
remote_name = "GroupDocs.Assembly/TableFeatures.odt"

with open("TableData.json") as f:
    data = f.read()

with open(filename, "rb") as template_file:
    upload_request = requests.UploadFileRequest(template_file, remote_name)
    assembly_api.upload_file(upload_request)

template_file_info = groupdocsassemblycloud.TemplateFileInfo(remote_name)
assemble_data = groupdocsassemblycloud.AssembleOptions(template_file_info, "pdf", data)
request = requests.AssembleDocumentRequest(assemble_data)
result = assembly_api.assemble_document(request)

print("Generated document size = " + str(len(result)))

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

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

import groupdocsassemblycloud
from groupdocsassemblycloud.models import requests

client_id = "YourClientId"
client_secret = "YourClientSecret"

assembly_api = groupdocsassemblycloud.AssemblyApi(client_id, client_secret)
assembly_api.api_client.configuration.host = "https://api.groupdocs.cloud"

result = assembly_api.get_supported_file_formats(requests.GetSupportedFileFormatsRequest())

for fmt in result.formats:
    print(fmt.file_format)

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

GroupDocs.Assembly Cloud Python SDKリポジトリには、すぐに実行できる単体テストと以下をカバーするサンプルが含まれています。

カテゴリー
ドキュメントアセンブリテンプレートと JSON データからドキュメントを組み立て、PDF 出力を生成
ファイル操作テンプレート ファイルをクラウド ストレージにアップロードする
情報サポートされているファイル形式

サンプルの実行方法

  1. クローンを作成するか、ダウンロードします。SDK repository2.編集Settings/servercreds.jsonそしてあなたの設定をAppSidそしてAppKey3. 依存関係をインストールします。pip install groupdocs-assembly-cloud -U4. リポジトリのルートからテストを実行します。python -m unittest discover -s test

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


Product Docs Swagger Examples Blog Support Dashboard


タグ

Document Automation | Python Cloud API | GroupDocs.Assembly Cloud | REST API | Document Generation | Template-Driven | Dynamic Data Merging | Rich Formatting | Conditional Content Control | List Automation | Table Automation | Barcode Generation | Hyperlink Insertion | Bookmark Creation | Checkbox Manipulation | Mail Merge | Formula Calculations | Chart Generation | Data Filtering | Data Sorting | Data Grouping | JWT Authentication | Microsoft Word | Microsoft Excel | Microsoft PowerPoint | Report Generation | Cloud-Based Flexibility | Secure API Access | Cross-platform API


 日本