Περιηγηθείτε στα Προϊόντα μας

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

Εγκατάσταση

Το πακέτο είναι διαθέσιμο στο rubygems.org και μπορεί να εγκατασταθεί μέσω gem εκτελώντας την παρακάτω εντολή:

gem install groupdocs_editor_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


Απαιτήσεις

  • Ruby ~> 2.3
  • RubyGems
  • Διαπιστευτήρια GroupDocs Cloud — Client ID and Client Secret από τον Πίνακα ελέγχου

Εξαρτήσεις

Το SDK απαιτεί τα ακόλουθα gems:

PackageConstraint
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.

Λήψη υποστηριζόμενων μορφών Editor

Ανακτήστε τις μορφές εγγράφων που μπορεί να επεξεργαστεί το 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 περιλαμβάνει έτοιμα προς εκτέλεση παραδείγματα που καλύπτουν:

CategoryExamples
Edit OperationsΕπεξεργασία κειμένου, υπολογιστικά φύλλα, παρουσιάσεις, κείμενο και αρχεία με διαχωριστικά
InfoΠληροφορίες εγγράφου, κατανάλωση άδειας, υποστηριζόμενοι τύποι αρχείων

Τρόπος εκτέλεσης των παραδειγμάτων

  1. Κλωνοποιήστε ή κατεβάστε το αποθετήριο παραδειγμάτων
  2. Επεξεργαστείτε το Examples/RunExamples.rb και ορίστε τα client_id και client_secret
  3. Μεταβείτε στον κατάλογο Examples
  4. Εκτελέστε gem install groupdocs_editor_cloud
  5. Εκτελέστε ruby RunExamples.rb

Για περισσότερες λεπτομέρειες, επισκεφθείτε το 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



 Ελληνικά