<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!  

Editor Dokumen Java Cloud REST API

main-banner

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

GroupDocs.Editor Cloud SDK for Java membantu Anda membangun Cloud Document Editor Java Apps yang berfungsi tanpa memasang perangkat lunak pihak ketiga. Itu adalah pembungkus di sekitar GroupDocs.Editor Cloud REST APIs.


Persyaratan

Membangun pustaka klien API memerlukan:

  1. Jawa 1.7+
  2. Maven

Prasyarat

Untuk menggunakan GroupDocs.Editor Cloud SDK for Java, Anda perlu mendaftarkan akun dengan GroupDocs Cloud dan mencari/membuat ID Klien dan Rahasia Klien di Cloud Dashboard. Tersedia kuota gratis. Untuk detail selengkapnya, lihat GroupDocs Cloud Pricing.

Instal GroupDocs.Editor-Cloud dari Maven

Tambahkan repositori Cloud GroupDocs ke pom.xml aplikasi Anda

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

Instal dari sumber

Untuk menginstal pustaka klien API ke repositori Maven lokal Anda, cukup jalankan:

mvn clean install

Untuk menyebarkannya ke repositori Maven jarak jauh, konfigurasikan pengaturan repositori dan jalankan:

mvn clean deploy

Lihat OSSRH Guide untuk informasi lebih lanjut.

Pengguna Maven

Tambahkan dependensi ini ke POM proyek Anda:

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

Yang lain

Mula-mula buat JAR dengan mengeksekusi:

mvn clean package

Kemudian instal JAR berikut secara manual:

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

Memulai

Harap ikuti petunjuk Quick Start.

Contoh Kode Java untuk mengedit DOCX di 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());

Otorisasi & Otentikasi

Authentication schemes yang ditentukan untuk API adalah sebagai berikut:

JWT

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

VersionRelease Date
22.525 Mei 2022
19.1125 Januari 2022
21.725 Januari 2022