Navegue pelos nossos produtos

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

Instalação

O pacote está disponível em nuget.org e pode ser instalado pelo Console do Gerenciador de Pacotes com o seguinte comando:

NuGet\Install-Package GroupDocs.editor-Cloud

Version NuGet NuGet-GroupDocsCloud


Requisitos

  • .NET Framework 2.0 ou .NET Standard 2.0
  • NuGet
  • System.Web ao direcionar para o .NET Framework 2.0
  • Credenciais do GroupDocs Cloud — Client ID and Client Secret do painel

Início rápido

Obter as credenciais de API

Para usar o GroupDocs.Editor Cloud, inscreva-se no painel do GroupDocs.Cloud e obtenha o Client ID e o Client Secret.

Inicializar a API

Use o código a seguir para começar a usar o 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);

Veja o exemplo completo em Common.cs.

Editar um documento do Word

Este exemplo carrega um documento do Word protegido por senha, substitui texto no HTML e salva um arquivo 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);

Veja o exemplo completo em EditWordProcessingDocument.cs.

Editar uma planilha

Este exemplo carrega a primeira planilha, substitui texto e salva um arquivo 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);

Veja o exemplo completo em EditSpreadsheetDocument.cs.

Obter informações do documento

Este exemplo devolve a contagem de páginas de um documento do Word protegido por senha.

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);

Veja o exemplo completo em GetDocumentInformation.cs.

Obter os tipos de arquivo compatíveis

Recupere os formatos aceitos pela API editor.

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)}");
}

Veja o exemplo completo em GetSupportedFileTypes.cs.

Exemplos no GitHub

O repositório GroupDocs.Editor Cloud .NET Examples inclui exemplos prontos para executar sobre:

CategoryExamples
EditarProcessamento de texto, planilha, apresentação, texto delimitado, texto sem formatação
InfoInformações do documento, tipos de arquivo compatíveis, consumo de licença

Como executar os exemplos

  1. Clone ou baixe o repositório de exemplos
  2. Abra Examples/GroupDocs.Editor.Cloud.Examples.CSharp.sln no Visual Studio 2017 ou posterior
  3. Clique com o botão direito do mouse na solução e selecione Enable NuGet Package Restore
  4. Edite Examples/GroupDocs.Editor.Cloud.Examples.CSharp/RunExamples.cs e defina Common.MyClientId e Common.MyClientSecret
  5. Compile e execute

Para mais detalhes, visite Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Marcas

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


 Português