Explore nuestros productos

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

Instalación

El paquete está disponible en nuget.org y se puede instalar desde la consola del Administrador de paquetes con el siguiente comando:

NuGet\Install-Package GroupDocs.editor-Cloud

Version NuGet NuGet-GroupDocsCloud


Requisitos

  • .NET Framework 2.0 o .NET Standard 2.0
  • NuGet
  • System.Web al dirigirse a .NET Framework 2.0
  • Credenciales de GroupDocs Cloud — Client ID and Client Secret del panel

Inicio rápido

Obtener las credenciales de API

Para usar GroupDocs.Editor Cloud, regístrese en el panel de GroupDocs.Cloud y obtenga el Client ID y el Client Secret.

Inicializar la API

Use el código siguiente para empezar a usar 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);

Vea el ejemplo completo en Common.cs.

Editar un documento de Word

Este ejemplo carga un documento de Word protegido con contraseña, reemplaza texto en el HTML y guarda un archivo 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);

Vea el ejemplo completo en EditWordProcessingDocument.cs.

Editar una hoja de cálculo

Este ejemplo carga la primera hoja de cálculo, reemplaza texto y guarda un archivo 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);

Vea el ejemplo completo en EditSpreadsheetDocument.cs.

Obtener información del documento

Este ejemplo devuelve el número de páginas de un documento de Word protegido con contraseña.

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

Vea el ejemplo completo en GetDocumentInformation.cs.

Obtener los tipos de archivo admitidos

Recupere los formatos que acepta la API de 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)}");
}

Vea el ejemplo completo en GetSupportedFileTypes.cs.

Ejemplos en GitHub

El repositorio GroupDocs.Editor Cloud .NET Examples incluye ejemplos listos para ejecutar sobre:

CategoryExamples
EditarProcesamiento de texto, hoja de cálculo, presentación, texto delimitado, texto sin formato
InfoInformación del documento, tipos de archivo admitidos, consumo de licencia

Cómo ejecutar los ejemplos

  1. Clone o descargue el repositorio de ejemplos
  2. Abra Examples/GroupDocs.Editor.Cloud.Examples.CSharp.sln en Visual Studio 2017 o posterior
  3. Haga clic con el botón derecho en la solución y seleccione Enable NuGet Package Restore
  4. Edite Examples/GroupDocs.Editor.Cloud.Examples.CSharp/RunExamples.cs y establezca Common.MyClientId y Common.MyClientSecret
  5. Compile y ejecute

Para obtener más detalles, visite Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Etiquetas

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


 Español