GroupDocs.Editor Cloud SDK for Ruby 很容易与 GroupDocs.Cloud REST API 集成,从而允许在 Ruby 应用程序中快速编辑各种文档格式,而无需安装 MS Office 或其他应用程序。使用文档编辑器库——在处理演示文稿、Excel 电子表格、HTML、XML 和文字处理文档的同时,轻松执行所有最需要的文档编辑操作。只需通过 GroupDocs.Editor Cloud API 将要编辑的文档文件上传到任何前端所见即所得编辑器中,对其进行操作并轻松转换回其原始文档类型。
GroupDocs.Editor Cloud SDK for Ruby 构建为 GroupDocs.Editor Cloud REST API 之上的一个层,通过管理低级请求和处理响应来节省宝贵的开发时间。开发人员可以专注于仅根据项目需要编写特定代码。
如果您正在寻找在云中注释文件的源代码,请查看 GroupDocs.Editor Cloud SDK for Ruby at GitHub .
您可以 试用 GroupDocs.Editor 低代码 Ruby API,没有任何限制。
GroupDocs.Editor Cloud 也可用作 Docker 镜像,可用于自托管 服务。或者,您可以使用目前驱动我们的 REST API 的 GroupDocs.Editor 高代码 API 构建您自己的服务。
//Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
fileApi = GroupDocsEditorCloud::FileApi.from_keys($app_sid, $app_key)
editApi = GroupDocsEditorCloud::EditApi.from_keys($app_sid, $app_key)
# The document already uploaded into the storage.
# Load it into editable state
fileInfo = GroupDocsEditorCloud::FileInfo.new
fileInfo.file_path = 'Presentation/with-notes.pptx'
loadOptions = GroupDocsEditorCloud::PresentationLoadOptions.new
loadOptions.file_info = fileInfo
loadOptions.output_path = "output"
loadOptions.slide_number = 0
loadRequest = GroupDocsEditorCloud::LoadRequest.new(loadOptions)
loadResult = editApi.load(loadRequest)
# Download html document
htmlFile = fileApi.download_file(GroupDocsEditorCloud::DownloadFileRequest.new loadResult.html_path)
htmlFile.open
html = htmlFile.read
htmlFile.close
# Edit something...
html = html.gsub("Slide sub-heading", "Hello world!")
# Upload html back to storage
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)
# Save html back to pptx
saveOptions = GroupDocsEditorCloud::PresentationSaveOptions.new
saveOptions.file_info = fileInfo
saveOptions.output_path = "output/edited.pptx"
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)