Python 文档编辑器 REST API 和 SDK 文档编辑器

REST API 文档编辑器,可使用任意 HTML WYSIWYG 编辑器编辑流行文档格式,无需安装外部应用程序。

  • GroupDocs.Editor 用于 cURL
  • GroupDocs.Editor 用于 .NET
  • GroupDocs.Editor 用于 Java
  • GroupDocs.Editor 用于 PHP
  • GroupDocs.Editor 用于 Ruby
  • GroupDocs.Editor 用于 Node.js
  • GroupDocs.Editor 用于 Android
开始免费试用

GroupDocs.Editor Cloud SDK for Python 使开发者能够更轻松地在基于 Python 的应用中通过与 GroupDocs.Editor Cloud REST API 集成来加入文档编辑功能。只需在任意前端 HTML 编辑器中使用 GroupDocs.Editor Cloud API 获取受支持的文档类型(Microsoft Word、Excel 电子表格、PowerPoint、TXT、HTML、XML),即可执行高级文档编辑操作,并在编辑后将文档保存回原始格式。

GroupDocs.Editor Cloud SDK for Python 构建在 GroupDocs.Editor Cloud REST API 之上,作为一层抽象,能够通过管理底层请求和处理响应,为您节省宝贵的开发时间。开发者只需在项目中根据需要编写特定代码即可。

常见问题

我想创建自己的 Python 应用程序来编辑文档?

如果您正在寻找用于在云端标注文件的源代码,请查看GroupDocs.Editor Cloud SDK 用于 Python 在 GitHub。

我可以免费在 Python 上试用 GroupDocs.Editor REST APIs 吗?

您可以尝试 GroupDocs.Editor低代码 Python APIs,且没有任何限制。

我不想将机密文件上传到任何地方进行编辑,我有哪些可选方案?

GroupDocs.Editor Cloud 也提供 Docker 镜像,可用于自托管该服务。或者,您可以使用GroupDocs.Editor 高代码 APIs(https://products.groupdocs.com/editor/)来构建自己的服务,该服务目前驱动我们的 REST APIs。

高级文档编辑器 REST API 功能

可轻松集成到任何所见即所得编辑器中

编辑 Word 文档时,你可以整体编辑或定义页面范围。

你可以使用多标签页进行电子表格编辑。

你在处理大型 CSV 或 TSV 文件时,内存使用已被优化。

你可以提取文档信息(类型、大小、页数等)。

你可以在任何语言或平台上使用 Cloud REST API。

处理 WordProcessing 文档 - Python

  //Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
  editApi = groupdocs_editor_cloud.EditApi.from_keys(app_sid, app_key)
  fileApi = groupdocs_editor_cloud.FileApi.from_keys(app_sid, app_key)
  
  # The document already uploaded into the storage.
  # Load it into editable state
  fileInfo = groupdocs_editor_cloud.FileInfo("WordProcessing/password-protected.docx", None, None, "password")
  loadOptions = groupdocs_editor_cloud.WordProcessingLoadOptions()
  loadOptions.file_info = fileInfo
  loadOptions.output_path = "output"
  loadResult = editApi.load(groupdocs_editor_cloud.LoadRequest(loadOptions))        
  
  # Download html document
  htmlFile = fileApi.download_file(groupdocs_editor_cloud.DownloadFileRequest(loadResult.html_path))
  html = ""       
  with open(htmlFile, 'r') as file:
      html = file.read()
  
  # Edit something...    
  html = html.replace("Sample test text", "Hello world")
  
  # Upload html back to storage
  with open(htmlFile, 'w') as file:
      file.write(html)
  
  fileApi.upload_file(groupdocs_editor_cloud.UploadFileRequest(loadResult.html_path, htmlFile))
  
  # Save html back to docx
  saveOptions = groupdocs_editor_cloud.WordProcessingSaveOptions()
  saveOptions.file_info = fileInfo
  saveOptions.output_path = "output/edited.docx"
  saveOptions.html_path = loadResult.html_path
  saveOptions.resources_path = loadResult.resources_path
  saveResult = editApi.save(groupdocs_editor_cloud.SaveRequest(saveOptions))

  # Done
  print("Document edited: " + saveResult.path)

支持和学习资源

GroupDocs.Editor 为其他流行的开发环境提供文档查看 APIs

  中文
e22420b0c