製品を閲覧する

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

インストール

パッケージは npmjs.com で入手できます。次のコマンドを実行して npm でインストールできます。

npm install groupdocs-editor-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


要件

依存関係

SDK には次のパッケージが必要です。

PackageConstraint
axios1.8.4
form-data*
jsonwebtoken9.0.1
qs6.11.2

クイックスタート

API 認証情報を取得する

GroupDocs.Editor Cloud を使用するには、GroupDocs.Cloud Dashboard で登録し、Client ID と Client Secret を取得します。

API を初期化する

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

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const editApi = editor_cloud.EditApi.fromConfig(config);

完全な例は RunExamples.js を参照してください。

ワープロ文書を編集する

初期化したら、この基本例を使ってパスワードで保護された Word 文書を読み込み、HTML のテキストを置き換えて DOCX に保存し直します。

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const editApi = editor_cloud.EditApi.fromConfig(config);
const fileApi = editor_cloud.FileApi.fromConfig(config);

(async () => {
    let fileInfo = new editor_cloud.FileInfo();
    fileInfo.filePath = "WordProcessing/password-protected.docx";
    fileInfo.password = "password";
    let loadOptions = new editor_cloud.WordProcessingLoadOptions();
    loadOptions.fileInfo = fileInfo;
    loadOptions.outputPath = "output";
    let loadResult = await editApi.load(new editor_cloud.LoadRequest(loadOptions));

    let buf = await fileApi.downloadFile(new editor_cloud.DownloadFileRequest(loadResult.htmlPath));
    let htmlString = buf.toString("utf-8");
    htmlString = htmlString.replace("Sample test text", "Hello world");
    await fileApi.uploadFile(new editor_cloud.UploadFileRequest(loadResult.htmlPath, new Buffer(htmlString, "utf-8")));

    let saveOptions = new editor_cloud.WordProcessingSaveOptions();
    saveOptions.fileInfo = fileInfo;
    saveOptions.outputPath = "output/edited.docx";
    saveOptions.htmlPath = loadResult.htmlPath;
    saveOptions.resourcesPath = loadResult.resourcesPath;
    let saveResult = await editApi.save(new editor_cloud.SaveRequest(saveOptions));
    console.log("Document edited: " + saveResult.path);
})();

完全な例は EditWordProcessingDocument.js を参照してください。

スプレッドシートを編集する

この例は最初のワークシートを読み込み、HTML を編集して XLSX に保存し直します。

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const editApi = editor_cloud.EditApi.fromConfig(config);
const fileApi = editor_cloud.FileApi.fromConfig(config);

(async () => {
    let fileInfo = new editor_cloud.FileInfo();
    fileInfo.filePath = "Spreadsheet/four-sheets.xlsx";
    let loadOptions = new editor_cloud.SpreadsheetLoadOptions();
    loadOptions.fileInfo = fileInfo;
    loadOptions.outputPath = "output";
    loadOptions.worksheetIndex = 0;
    let loadResult = await editApi.load(new editor_cloud.LoadRequest(loadOptions));

    let buf = await fileApi.downloadFile(new editor_cloud.DownloadFileRequest(loadResult.htmlPath));
    let htmlString = buf.toString("utf-8");
    htmlString = htmlString.replace("This is sample sheet", "This is sample sheep");
    await fileApi.uploadFile(new editor_cloud.UploadFileRequest(loadResult.htmlPath, new Buffer(htmlString, "utf-8")));

    let saveOptions = new editor_cloud.SpreadsheetSaveOptions();
    saveOptions.fileInfo = fileInfo;
    saveOptions.outputPath = "output/edited.xlsx";
    saveOptions.htmlPath = loadResult.htmlPath;
    saveOptions.resourcesPath = loadResult.resourcesPath;
    let saveResult = await editApi.save(new editor_cloud.SaveRequest(saveOptions));
    console.log("Document edited: " + saveResult.path);
})();

完全な例は EditSpreadsheetDocument.js を参照してください。

文書情報を取得する

この例はパスワードで保護された Word 文書のページ数を返します。

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = editor_cloud.InfoApi.fromConfig(config);

(async () => {
    let fileInfo = new editor_cloud.FileInfo();
    fileInfo.filePath = "WordProcessing/password-protected.docx";
    fileInfo.password = "password";
    fileInfo.storageName = "First Storage";
    let request = new editor_cloud.GetInfoRequest(fileInfo);
    let response = await infoApi.getInfo(request);
    console.log("GetDocumentInfo: Page Count = " + response.pageCount);
})();

完全な例は GetDocumentInfo.js を参照してください。

対応している編集形式を取得する

API が編集できる文書形式を取得します。

"use strict";
const editor_cloud = require("groupdocs-editor-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new editor_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = editor_cloud.InfoApi.fromConfig(config);

(async () => {
    let response = await infoApi.getSupportedFileFormats();
    console.log("Supported file-formats:");
    response.formats.forEach(function (format) {
        console.log(format.fileFormat + "(" + format.extension + ")");
    });
})();

完全な例は GetSupportedFormats.js を参照してください。

GitHub のサンプル

GroupDocs.Editor Cloud Node.js Examples リポジトリには、次を扱う実行可能なサンプルが含まれています。

CategoryExamples
Edit Operationsワープロ, スプレッドシート, プレゼンテーション, テキスト, 区切りファイル
Info文書情報, ライセンス消費, 対応しているファイルの種類

サンプルの実行方法

  1. サンプルリポジトリ をクローンまたはダウンロードします
  2. Examples/RunExamples.js を編集し、clientId と clientSecret を設定します
  3. Examples ディレクトリに移動します
  4. npm install を実行します
  5. npm update を実行します
  6. npm run-script start を実行します

詳細は Getting Started を参照してください。


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Editing API | Node.js Cloud API | GroupDocs.Editor Cloud | REST API | Word Processing Formats | Spreadsheet Formats | Presentation Formats | Text Formats | CSV Files | DOCX Documents | XLSX Documents | PPTX Presentations | Password-Protected Files | Cloud Storage Integration | Document Info Retrieval | File Operations | WYSIWYG Editing | Multi-Platform Support | Secure API Access | HTML Editing | Cross-platform API



 日本