
Another good news for Cloud Developers! GroupDocs has launched the Document Editing Cloud API. This improves the document editing solution of GroupDocs. The solution already exists for .NET and Java developers as on-premises APIs, and as cross-platform online apps for any kind of user to edit a document online for free. The GroupDocs.Editor Cloud API along with SDKs allow developers to edit most of the popular document formats using front-end WYSIWYG editors without any additional applications.
GroupDocs.Editor Cloud is the REST API that provides many editing options and output customizations to customize the editing process of various document types. Some of the main features include:
- Edit a word processing document in a flow or paged mode.
- Manage font extraction to provide the same user experience.
- Memory usage optimization of large files.
- Support of multi-tabbed spreadsheets.
- Flexible numeric and dates conversion.
- URI and Email address recognition.
To get a much better idea about the features and the product, you can always visit the developer guide in the documentation section.
Supported Document Types
Here are the currently supported document formats. You can visit the documentation for GroupDocs.Editor Cloud any time to know about all the supported document formats.
SDKs and Samples
Along with the document editing REST API for Cloud, GroupDocs also provides open-source SDKs, therefore, these can be self-customized according to the requirements. Developers can use cURL to interact with GroupDocs.Editor Cloud API and can also use the relevant SDK(s) to speed up the development. This helps developers to stop worrying about low-level details of making a request and handling the responses. Below-mentioned SDKs along with the code examples are available on GitHub:
Edit Word Document in C#
Here you can see the C# code example to edit a word document using GroupDocs.Editor Cloud SDK for .NET. The same can be easily achieved in Java, PHP, Python, Ruby, and Node.js using relevant available SDKs. This simply converts the source document in HTML format and allows to edit, later it converts the updated document back to the original format.
// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var editApi = new EditApi(configuration ); | |
var fileApi = new FileApi(configuration ); | |
// The document already uploaded into the storage. | |
// Load it into editable state | |
var loadOptions = new WordProcessingLoadOptions | |
{ | |
FileInfo = new FileInfo | |
{ | |
FilePath = "WordProcessing/password-protected.docx", | |
Password = "password" | |
}, | |
OutputPath = "output" | |
}; | |
var loadResult = editApi.Load(new LoadRequest(loadOptions)); | |
// Download html document | |
var stream = fileApi.DownloadFile(new DownloadFileRequest(loadResult.HtmlPath)); | |
var htmlString = new StreamReader(stream, Encoding.UTF8).ReadToEnd(); | |
// Edit something... | |
htmlString = htmlString.Replace("Sample test text", "Hello world"); | |
// Upload html back to storage | |
fileApi.UploadFile(new UploadFileRequest(loadResult.HtmlPath, | |
new MemoryStream(Encoding.UTF8.GetBytes(htmlString)))); | |
// Save html back to docx | |
var saveOptions = new WordProcessingSaveOptions | |
{ | |
FileInfo = loadOptions.FileInfo, | |
OutputPath = "output/edited.docx", | |
HtmlPath = loadResult.HtmlPath, | |
ResourcesPath = loadResult.ResourcesPath | |
}; | |
var saveResult = editApi.Save(new SaveRequest(saveOptions)); |
Update Excel Spreadsheet Document in Java
Below is the code snippet that shows how you can quickly edit a spreadsheet document in your Java application with GroupDocs.Editor Cloud SDK for Java.
// 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("Spreadsheet/four-sheets.xlsx"); | |
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions(); | |
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("This is sample sheet", "This is sample sheep")); | |
} | |
Files.write(file.toPath(), newLines); | |
// Upload html back to storage | |
fileApi.uploadFile(new UploadFileRequest(loadResult.getHtmlPath(), file, Common.MYStorage)); | |
// Save html back to xlsx | |
SpreadsheetSaveOptions saveOptions = new SpreadsheetSaveOptions(); | |
saveOptions.setFileInfo(fileInfo); | |
saveOptions.setOutputPath("output/edited.xlsx"); | |
saveOptions.setHtmlPath(loadResult.getHtmlPath()); | |
saveOptions.setResourcesPath(loadResult.getResourcesPath()); | |
DocumentResult saveResult = editApi.save(new SaveRequest(saveOptions)); | |
System.out.println("Document edited: " + saveResult.getPath()); |
Edit a Presentation in Python
Here is the code example to show how you can edit PowerPoint or OpenDocument presentations in Python.
# For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-python-samples | |
import groupdocs_editor_cloud | |
app_sid = "XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
app_key = "XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
editApi = groupdocs_editor_cloud.EditApi.from_keys(app_sid, app_key) | |
fileApi = groupdocs_editor_cloud.FileApi.from_keys(app_sid, app_key) | |
# The document already uploaded into the storage. | |
# Load it into editable state | |
fileInfo = groupdocs_editor_cloud.FileInfo("Presentation/with-notes.pptx") | |
loadOptions = groupdocs_editor_cloud.PresentationLoadOptions() | |
loadOptions.file_info = fileInfo | |
loadOptions.output_path = "output" | |
loadOptions.slide_number = 0 | |
loadResult = editApi.load(groupdocs_editor_cloud.LoadRequest(loadOptions)) | |
# Download html document | |
htmlFile = fileApi.download_file(groupdocs_editor_cloud.DownloadFileRequest(loadResult.html_path)) | |
html = "" | |
with open(htmlFile, 'r') as file: | |
html = file.read() | |
# Edit something... | |
html = html.replace("Slide sub-heading", "Hello world!") | |
# Upload html back to storage | |
with open(htmlFile, 'w') as file: | |
file.write(html) | |
fileApi.upload_file(groupdocs_editor_cloud.UploadFileRequest(loadResult.html_path, htmlFile)) | |
# Save html back to pptx | |
saveOptions = groupdocs_editor_cloud.PresentationSaveOptions() | |
saveOptions.file_info = fileInfo | |
saveOptions.output_path = "output/edited.pptx" | |
saveOptions.html_path = loadResult.html_path | |
saveOptions.resources_path = loadResult.resources_path | |
saveResult = editApi.save(groupdocs_editor_cloud.SaveRequest(saveOptions)) | |
# Done | |
print("Document edited: " + saveResult.path) |
Resources
Here are some important links to the relevant resources:
Good to see you here for the Document Editing Cloud API. You can freely contact us on the forum in case you feel any difficulty or have some confusion or to give some good suggestions. Thanks.