如何以编程方式操作原生谷歌文档文件 [英] How to programmatically manipulate native google doc files

查看:11
本文介绍了如何以编程方式操作原生谷歌文档文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以以编程方式编辑原生 Google 文档,例如将某些字词加粗或超链接?我知道我可以将其导出为某种格式,如 DOC 或 ODT,进行更改并放回原处.但是手动尝试了这种方式,发现我失去了确切的外观.找不到任何适用于本机 Google 文档的 API 或对象模型,尽管电子表格似乎有一些东西.

Is it possible to programmatically edit a native Google document, say to make certain words bold or hyperlinks? I know I can export that to some format like DOC or ODT, do the changes and put back. But tried this way manually and saw that I lost the exact look. Could not find any API or object model for native Google docs, although seems there is something for the spreadsheets.

推荐答案

很遗憾,无法使用 REST API 以编程方式编辑 Google 文档(Google 的文字处理器文档).目前只有 Google 电子表格提供这样的 API.

Unfortunately it is not possible to programmatically edit Google Documents (Google's Word Processor document) using a REST API. Only Google Spreadsheet offers such an API at the moment.

您可以尝试 Google Apps 脚本:https://developers.google.com/apps-script/ 它是一个托管脚本环境,它提供 Google 文档服务,允许您编辑和管理现有的 Google 文档.

You could try Google Apps Script: https://developers.google.com/apps-script/ it is a hosted scripting environment and it offers a Google Documents Service that allows you to edit and manage existing Google Documents.

最后,您始终可以使用 RTF 等开放格式上传文档,并使用 Google Drive API 将其转换为原生 Google 文档.

Lastly you could always upload a document using an open format such as RTF and have it converted to a native Google Documents using the Google Drive API.

这篇关于如何以编程方式操作原生谷歌文档文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆