Working with WordProcessing Documents

Introduction

WordProcessing is the most used and known document family format, that includes DOC, DOT, DOCX, DOCM, DOTX, ODT, RTF and much more. All these formats are supported by the GroupDocs.Editor Cloud. There several steps that usage of GroupDocs.Editor Cloud consists of:

  1. Upload input document into cloud storage
  2. Load the document into editable representation in the cloud storage (HTML file and resources)
  3. Download HTML document (and resources, if needed) from storage
  4. Edit HTML document at client side
  5. Upload HTML document back into the storage
  6. Save the edited document into WordProcessing format in the storage
  7. Download saved document

Steps 1, 3, 4, 5 are storage operations, please refer to this Storage Operations) for usage details. Step 4 is a custom edit operation that can be performed with the programming language or 3rd party tools.

Below is a detailed description of steps 2 and 6.

Loading WordProcessing documents

This REST API provides an ability to load the input documents into an editable representation.

Resources

HTTP POST ~/load

Swagger UI lets you call this REST API directly from the browser. The following properties of loading WordProcessing documents may be customized:

NameDescriptionComment
FileInfo.FilePathThe file path in the storageRequired property
FileInfo.StorageNameStorage nameCould be omitted for default storage
FileInfo.VersionIdFile version IdUseful for storages that support file versioning
FileInfo.PasswordThe password to open fileShould be specified only for password-protected documents
OutputPathThe full output pathThe directory in storage, where editable files will be stored
EnablePaginationAllows to enable or disable pagination in the resultant HTML document. By default is disabled (false).
EnableLanguageInformationSpecifies whether language information is exported to the HTML markup in a form of ‘lang’ HTML attributes. This option may be useful for roundtrip conversion of the multi-language documents. By default, it is disabled (false).
FontExtractionResponsible for extracting font resources, which are used in the input WordProcessing document. By default doesn’t extract any fonts (NotExtract). Possible values are: NotExtract, ExtractAllEmbedded,ExtractEmbeddedWithoutSystem, ExtractAll

cURL Example

* First get JSON Web Token
* Please get your App Key and App SID from https://dashboard.groupdocs.cloud/#/apps. Kindly place App Key in "client_secret" and App SID in "client_id" argument.
curl -v "https://api.groupdocs.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

* cURL example to load document
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer
<jwt token>"
-d "{
    'FileInfo': { 'FilePath': 'WordProcessing/four-pages.docx' },
  'OutputPath': 'Output',
  'EnablePagination': true,
  'FontExtraction': 'ExtractAllEmbedded'
 }"
* Response will contain storage path to resultant documents
{
  "resourcesPath": "output\four-pages.files",
  "htmlPath": "output\four-pages.html"
}

SDKs

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Editor Cloud SDKs along with working examples, to get you started in no time. Please check  article to learn how to add an SDK to your project.

Working with WordProcessing Documents Examples