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.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.

Установка
Пакет доступен на rubygems.org и может быть установлен через gem следующей командой:
gem install groupdocs_editor_cloud

Требования
Зависимости
SDK требует следующие gems:
| Package | Constraint |
|---|
| addressable | ~> 2.8.4, >= 2.8.4 |
| faraday | ~> 0.14.0 |
Быстрый старт
Получите учетные данные API
Чтобы использовать GroupDocs.Editor Cloud, зарегистрируйтесь на GroupDocs.Cloud Dashboard и получите Client ID и Client Secret.
Инициализируйте API
Используйте следующий код, чтобы начать использовать 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)
Полный пример см. в RunExamples.rb.
Редактировать текстовый документ
После инициализации используйте этот базовый пример, чтобы загрузить защищенный паролем документ, изменить его HTML и снова сохранить как 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)
Полный пример см. в EditWordProcessingDocument.rb.
Редактировать электронную таблицу
Этот пример загружает первый лист, редактирует HTML и снова сохраняет его как 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)
Полный пример см. в EditSpreadsheetDocument.rb.
Получить сведения о документе
Этот пример читает число страниц документа, защищенного паролем.
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)
Полный пример см. в GetDocumentInformation.rb.
Получить поддерживаемые форматы редактирования
Получите форматы документов, которые API может редактировать.
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
Полный пример см. в GetSupportedFileTypes.rb.
Примеры на GitHub
Репозиторий GroupDocs.Editor Cloud Ruby Examples содержит готовые к запуску примеры:
| Category | Examples |
|---|
| Edit Operations | Обработка текста, электронная таблица, презентация, текст и файлы с разделителями |
| Info | Сведения о документе, расход лицензии, поддерживаемые типы файлов |
Как запустить примеры
- Клонируйте или скачайте репозиторий примеров
- Отредактируйте
Examples/RunExamples.rb и задайте client_id и client_secret - Перейдите в каталог
Examples - Выполните
gem install groupdocs_editor_cloud - Выполните
ruby RunExamples.rb
Подробности см. в разделе Getting Started.

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