製品を閲覧する

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

インストール

パッケージは nuget.org で公開されています。パッケージ マネージャー コンソールで次のコマンドを実行してインストールできます。

NuGet\Install-Package GroupDocs.editor-Cloud

Version NuGet NuGet-GroupDocsCloud


要件

  • .NET Framework 2.0 または .NET Standard 2.0
  • NuGet
  • .NET Framework 2.0 を対象とする場合の System.Web
  • GroupDocs Cloud の資格情報 — ダッシュボードの Client ID and Client Secret

クイック スタート

API 資格情報を取得する

GroupDocs.Editor Cloud を使用するには、GroupDocs.Cloud ダッシュボード で登録し、Client ID と Client Secret を取得します。

API を初期化する

次のコードで GroupDocs.Editor Cloud SDK for .NET の使用を開始します。

using GroupDocs.Editor.Cloud.Sdk.Api;
using GroupDocs.Editor.Cloud.Sdk.Client;

string MyClientId = "YourClientId";
string MyClientSecret = "YourClientSecret";

var config = new Configuration(MyClientId, MyClientSecret);

var apiInstance = new EditApi(config);

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

Word 文書を編集する

この例では、パスワードで保護された Word 文書を読み込み、HTML 内のテキストを置換して DOCX ファイルを保存します。

using System.IO;
using System.Text;
using GroupDocs.Editor.Cloud.Sdk.Api;
using GroupDocs.Editor.Cloud.Sdk.Client;
using GroupDocs.Editor.Cloud.Sdk.Model;
using GroupDocs.Editor.Cloud.Sdk.Model.Requests;
using FileInfo = GroupDocs.Editor.Cloud.Sdk.Model.FileInfo;

var config = new Configuration("YourClientId", "YourClientSecret");
var editApi = new EditApi(config);
var fileApi = new FileApi(config);

var loadOptions = new WordProcessingLoadOptions
{
    FileInfo = new FileInfo
    {
        FilePath = "WordProcessing/password-protected.docx",
        Password = "password"
    },
    OutputPath = "output"
};

var loadResult = editApi.Load(new LoadRequest(loadOptions));
var stream = fileApi.DownloadFile(new DownloadFileRequest(loadResult.HtmlPath));
var htmlString = new StreamReader(stream, Encoding.UTF8).ReadToEnd();
htmlString = htmlString.Replace("Sample test text", "Hello world");

fileApi.UploadFile(new UploadFileRequest(loadResult.HtmlPath, new MemoryStream(Encoding.UTF8.GetBytes(htmlString))));

var saveOptions = new WordProcessingSaveOptions
{
    FileInfo = loadOptions.FileInfo,
    OutputPath = "output/edited.docx",
    HtmlPath = loadResult.HtmlPath,
    ResourcesPath = loadResult.ResourcesPath
};

var saveResult = editApi.Save(new SaveRequest(saveOptions));
Console.WriteLine("Document edited: " + saveResult.Path);

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

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

この例では、最初のワークシートを読み込み、テキストを置換して XLSX ファイルを保存します。

using System.IO;
using System.Text;
using GroupDocs.Editor.Cloud.Sdk.Api;
using GroupDocs.Editor.Cloud.Sdk.Client;
using GroupDocs.Editor.Cloud.Sdk.Model;
using GroupDocs.Editor.Cloud.Sdk.Model.Requests;
using FileInfo = GroupDocs.Editor.Cloud.Sdk.Model.FileInfo;

var config = new Configuration("YourClientId", "YourClientSecret");
var editApi = new EditApi(config);
var fileApi = new FileApi(config);

var loadOptions = new SpreadsheetLoadOptions
{
    FileInfo = new FileInfo { FilePath = "Spreadsheet/four-sheets.xlsx" },
    OutputPath = "output",
    WorksheetIndex = 0
};

var loadResult = editApi.Load(new LoadRequest(loadOptions));
var stream = fileApi.DownloadFile(new DownloadFileRequest(loadResult.HtmlPath));
var htmlString = new StreamReader(stream, Encoding.UTF8).ReadToEnd();
htmlString = htmlString.Replace("This is sample sheet", "This is sample sheep");

fileApi.UploadFile(new UploadFileRequest(loadResult.HtmlPath, new MemoryStream(Encoding.UTF8.GetBytes(htmlString))));

var saveOptions = new SpreadsheetSaveOptions
{
    FileInfo = loadOptions.FileInfo,
    OutputPath = "output/edited.xlsx",
    HtmlPath = loadResult.HtmlPath,
    ResourcesPath = loadResult.ResourcesPath
};

var saveResult = editApi.Save(new SaveRequest(saveOptions));
Console.WriteLine("Document edited: " + saveResult.Path);

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

文書情報を取得する

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

using GroupDocs.Editor.Cloud.Sdk.Api;
using GroupDocs.Editor.Cloud.Sdk.Client;
using GroupDocs.Editor.Cloud.Sdk.Model;
using GroupDocs.Editor.Cloud.Sdk.Model.Requests;

var config = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new InfoApi(config);

var request = new GetInfoRequest(new FileInfo
{
    FilePath = "WordProcessing/password-protected.docx",
    Password = "password"
});

var response = apiInstance.GetInfo(request);
Console.WriteLine("InfoResult.Pages.Count: " + response.PageCount);

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

サポートされるファイルの種類を取得する

editor API が受け付ける形式を取得します。

using GroupDocs.Editor.Cloud.Sdk.Api;
using GroupDocs.Editor.Cloud.Sdk.Client;

var config = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new InfoApi(config);

var response = apiInstance.GetSupportedFileFormats();

foreach (var entry in response.Formats)
{
    Console.WriteLine($"{entry.FileFormat}: {string.Join(",", entry.Extension)}");
}

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

GitHub の例

GroupDocs.Editor Cloud .NET Examples リポジトリには、次を扱うすぐに実行できる例があります。

CategoryExamples
編集ワープロ、スプレッドシート、プレゼンテーション、区切りテキスト、プレーン テキスト
Info文書情報、サポートされるファイルの種類、ライセンス消費

例の実行方法

  1. 例のリポジトリ をクローンまたはダウンロードします
  2. Visual Studio 2017 以降で Examples/GroupDocs.Editor.Cloud.Examples.CSharp.sln を開きます
  3. ソリューションを右クリックし、Enable NuGet Package Restore を選択します
  4. Examples/GroupDocs.Editor.Cloud.Examples.CSharp/RunExamples.cs を編集し、Common.MyClientId と Common.MyClientSecret を設定します
  5. ビルドして実行します

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


Product Docs Swagger Examples Blog Support Dashboard


タグ

Document Editing API | .NET 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 | API Explorer | Multi-Platform Support | SDK Support | Secure API Access


 日本