Browse our Products

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

Installation

The package is available at rubygems.org and it can be installed via gem by executing the following command:

gem install groupdocs_editor_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


Requirements

Dependencies

The SDK requires the following gems:

PackageConstraint
addressable~> 2.8.4, >= 2.8.4
faraday~> 0.14.0

Quick Start

Get your API credentials

To use GroupDocs.Editor Cloud, sign up at GroupDocs.Cloud Dashboard and get your Client ID and Client Secret.

Initialize the API

Use the following code to start using the GroupDocs.Editor Cloud SDK for Ruby.

require 'groupdocs_editor_cloud'

# Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsEditorCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

editApi = GroupDocsEditorCloud::EditApi.from_config(config)

See the full example in RunExamples.rb.

Edit a Word processing document

Once initialized, use this basic example to load a password-protected document, change its HTML, and save it back to DOCX.

require 'groupdocs_editor_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsEditorCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

fileApi = GroupDocsEditorCloud::FileApi.from_config(config)
editApi = GroupDocsEditorCloud::EditApi.from_config(config)

fileInfo = GroupDocsEditorCloud::FileInfo.new
fileInfo.file_path = 'WordProcessing/password-protected.docx'
fileInfo.password = 'password'

loadOptions = GroupDocsEditorCloud::WordProcessingLoadOptions.new
loadOptions.file_info = fileInfo
loadOptions.output_path = "output"

loadRequest = GroupDocsEditorCloud::LoadRequest.new(loadOptions)
loadResult = editApi.load(loadRequest)

htmlFile = fileApi.download_file(GroupDocsEditorCloud::DownloadFileRequest.new loadResult.html_path)
htmlFile.open
html = htmlFile.read
htmlFile.close

html = html.gsub("Sample test text", "Hello world")

htmlFile = File.open(htmlFile.path, "w")
htmlFile.write(html)
htmlFile.close
uploadRequest = GroupDocsEditorCloud::UploadFileRequest.new loadResult.html_path, File.open(htmlFile.path, "r")
fileApi.upload_file(uploadRequest)

saveOptions = GroupDocsEditorCloud::WordProcessingSaveOptions.new
saveOptions.file_info = fileInfo
saveOptions.output_path = "output/edited.docx"
saveOptions.html_path = loadResult.html_path
saveOptions.resources_path = loadResult.resources_path

saveRequest = GroupDocsEditorCloud::SaveRequest.new(saveOptions)
saveResult = editApi.save(saveRequest)

puts("Document edited: " + saveResult.path)

See the full example in EditWordProcessingDocument.rb.

Edit a Spreadsheet

This example loads the first worksheet, edits the HTML, and saves it back to XLSX.

require 'groupdocs_editor_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsEditorCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

fileApi = GroupDocsEditorCloud::FileApi.from_config(config)
editApi = GroupDocsEditorCloud::EditApi.from_config(config)

fileInfo = GroupDocsEditorCloud::FileInfo.new
fileInfo.file_path = 'Spreadsheet/four-sheets.xlsx'

loadOptions = GroupDocsEditorCloud::SpreadsheetLoadOptions.new
loadOptions.file_info = fileInfo
loadOptions.output_path = "output"
loadOptions.worksheet_index = 0

loadRequest = GroupDocsEditorCloud::LoadRequest.new(loadOptions)
loadResult = editApi.load(loadRequest)

htmlFile = fileApi.download_file(GroupDocsEditorCloud::DownloadFileRequest.new loadResult.html_path)
htmlFile.open
html = htmlFile.read
htmlFile.close

html = html.gsub("This is sample sheet", "This is sample sheep")

htmlFile = File.open(htmlFile.path, "w")
htmlFile.write(html)
htmlFile.close
uploadRequest = GroupDocsEditorCloud::UploadFileRequest.new loadResult.html_path, File.open(htmlFile.path, "r")
fileApi.upload_file(uploadRequest)

saveOptions = GroupDocsEditorCloud::SpreadsheetSaveOptions.new
saveOptions.file_info = fileInfo
saveOptions.output_path = "output/edited.xlsx"
saveOptions.html_path = loadResult.html_path
saveOptions.resources_path = loadResult.resources_path

saveRequest = GroupDocsEditorCloud::SaveRequest.new(saveOptions)
saveResult = editApi.save(saveRequest)

puts("Document edited: " + saveResult.path)

See the full example in EditSpreadsheetDocument.rb.

Get Document Information

This example reads the page count of a password-protected document.

require 'groupdocs_editor_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsEditorCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

infoApi = GroupDocsEditorCloud::InfoApi.from_config(config)
fileInfo = GroupDocsEditorCloud::FileInfo.new
fileInfo.file_path = 'WordProcessing/password-protected.docx'
fileInfo.password = 'password'
request = GroupDocsEditorCloud::GetInfoRequest.new(fileInfo)
response = infoApi.get_info(request)
puts("Pages count = " + response.page_count.to_s)

See the full example in GetDocumentInformation.rb.

Get Supported Editor Formats

Retrieve the document formats the API can edit.

require 'groupdocs_editor_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsEditorCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

infoApi = GroupDocsEditorCloud::InfoApi.from_config(config)
result = infoApi.get_supported_file_formats()
result.formats.each do |format|
    puts(format.file_format)
end

See the full example in GetSupportedFileTypes.rb.

Examples on GitHub

The GroupDocs.Editor Cloud Ruby Examples repository includes ready-to-run examples covering:

CategoryExamples
Edit OperationsWord processing, spreadsheet, presentation, text, and delimited files
InfoDocument information, license consumption, supported file types

How to run the examples

  1. Clone or download the examples repository
  2. Edit Examples/RunExamples.rb and set your client_id and client_secret
  3. Go to the Examples directory
  4. Run gem install groupdocs_editor_cloud
  5. Execute ruby RunExamples.rb

For more details, visit Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Editing API | Ruby 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 | WYSIWYG Editing | Multi-Platform Support | Secure API Access | HTML Editing | Cross-platform API



 English