<dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-editor-cloud</artifactId>
    <version>22.5</version>
</dependency>
copied!  
compile(group: 'com.groupdocs', name: 'groupdocs-editor-cloud', version: '22.5')
copied!  
<dependency org="com.groupdocs" name="groupdocs-editor-cloud" rev="22.5">
    <artifact name="groupdocs-editor-cloud" ext="jar"/>
</dependency>
copied!  
libraryDependencies += "com.groupdocs" % "groupdocs-editor-cloud" % "22.5"
copied!  

Document Editor Java Cloud REST API

banner

Product Page | Docs | Live Demos | Swagger UI | Code Samples | Blog | Free Support | Free Trial

GroupDocs.Editor Cloud SDK for Java helps you build cloud Document Editor Java Apps that work without installing any 3rd party software. It is a wrapper around GroupDocs.Editor Cloud REST APIs.

Cloud Document Editing SDK Features

  • Programmatically edit various types of documents and files in the cloud.
  • Various editing options are provided based on the file type, such as:
    • Word processing
      • Edit documents in the paged or pageless (flow) mode
      • Multi-language document editing
      • Extract font information to work with fonts to give same document appearance in various environments
    • Spreadsheets: Edit multi-tabbed worksheets.
    • Comma or Tab separated files (Delimiter Separated Values)
      • Specify value separator
      • Numeric conversion
      • Date conversion
      • Memory usage optimization to cater to large file processing
    • XML files
      • Resolve incorrect document structure
      • Recognize URIs & email addresses
      • Options to configure highlights & formatting
  • Cloud document information extraction facility to fetch info about the edited document.

Supported Document Editor Formats

Microsoft Word®: DOC, DOCX, DOCM, DOT, DOTM, DOTX, FlatOPC, RTF, WordML, TXT
OpenOffice Writer®: ODT, OTT
Microsoft Excel®: XLS, XLT, XLSX, XLSM, XLTX, XLTM, XLSB, XLAM, SpreadsheetML, DIF, DSV, CSV, TSV
OpenOffice Calc®: SXC, ODS, FODS
Microsoft PowerPoint®: PPT, PPTX, PPTM, PPS, PPSX, PPSM, POT, POTX, POTM
OpenOffice Impress®: ODP, OTP
Markup: HTML, XML

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven

Prerequisites

To use GroupDocs.Editor Cloud SDK for Java you need to register an account with GroupDocs Cloud and lookup/create Client ID and Client Secret at Cloud Dashboard. There is free quota available. For more details, see GroupDocs Cloud Pricing.

Install GroupDocs.Editor-Cloud from Maven

Add GroupDocs Cloud repository to your application pom.xml

<repository>
    <id>repository.groupdocs.cloud</id>
    <name>repository.groupdocs.cloud</name>
    <url>https://releases.groupdocs.cloud/java/repo/</url>
</repository>

Install from source

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project’s POM:

<dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-editor-cloud</artifactId>
    <version>22.5</version>
    <type>pom</type>
</dependency>

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/groupdocs-editor-cloud-22.5.jar
  • target/lib/*.jar

Get Started

Please follow the Quick Start instructions.

Sample Java Code to edit a DOCX in the Cloud

/ For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
  
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
 
 
// Create necessary API instances
EditApi editApi = new EditApi(configuration);
FileApi fileApi = new FileApi(configuration);
 
// The document already uploaded into the storage.
// Load it into editable state
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("WordProcessing/password-protected.docx");
fileInfo.setPassword("password");
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
loadOptions.setFileInfo(fileInfo);
loadOptions.setOutputPath("output");
LoadResult loadResult = editApi.load(new LoadRequest(loadOptions));
 
// Download html document
File file = fileApi.downloadFile(new DownloadFileRequest(loadResult.getHtmlPath(), null, null));
             
// Edit something...
List<String> lines = Files.readAllLines(file.toPath());
List<String> newLines = new ArrayList<String>();
for (String line : lines) {
    newLines.add(line.replaceAll("Sample test text", "Hello world"));
}
Files.write(file.toPath(), newLines);
 
// Upload html back to storage
fileApi.uploadFile(new UploadFileRequest(loadResult.getHtmlPath(), file, Common.MYStorage));
 
// Save html back to docx
WordProcessingSaveOptions saveOptions = new WordProcessingSaveOptions();
saveOptions.setFileInfo(fileInfo);
saveOptions.setOutputPath("output/edited.docx");    
saveOptions.setHtmlPath(loadResult.getHtmlPath());      
saveOptions.setResourcesPath(loadResult.getResourcesPath());
DocumentResult saveResult = editApi.save(new SaveRequest(saveOptions));
 
System.out.println("Document edited: " + saveResult.getPath());

Authorization & Authentication

Authentication schemes defined for the API is as follows:

JWT

Product Page | Docs | Live Demos | Swagger UI | Code Samples | Blog | Free Support | Free Trial

VersionRelease Date
23.11November 23, 2023
23.5May 23, 2023
22.5May 25, 2022
19.11January 25, 2022
21.7January 25, 2022