本文介绍了通过API在谷歌驱动器上创建一个新文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Google Drive API创建新文档(使用模板或完全动态)?我正在与需要生成word文档的客户端合作。我厌倦了查找,但我找不到有关如何使用API​​创建和格式化文档的足够文档。

例如,我可以以编程方式将客户的公司徽标包含在文档的顶部吗?我希望我为这个客户做的任何事情都是通用的(例如,在顶部包括标志等)是动态的,所以我可以重新为其他客户提供这个服务。



我也很难找到关于文档格式的文档(粗体,斜体,新段落)等。

解决方案

Google Drive API 仅限处理整个文件操作。它不理解文件的内容,包括格式。



您有两种选择: -


  1. 使用具有文件操作功能的Apps Script(即非Drive API)。请参阅 https://developers.google.com/apps-script/reference/document/ '



Is it possible to create a new document (either using a template or completely dynamic) using the Google Drive APIs? I am working with a client that requires generation of word documents. I tired looking up but I couldn't find sufficient documentation on how to "create and format" documents using the APIs.

For example, can I include the client's company logo on the top of the doc programmatically? I'd like whatever I am doing for this client to be generic (i.e including logo at the top etc) to be dynamic, so I can re-purpose this for other clients as well.

I also am having difficulty finding documentation on any kind of formatting we could do on the documents (bold, italic, new paragraph) etc

The Google Drive API only deals with whole file operations. It has no understanding of the content of the files, including formatting.

You have two options:-

  1. Use Apps Script (ie. not the Drive API) which has document manipulation features. See https://developers.google.com/apps-script/reference/document/

  2. Create your templates in HTML (or Word, OpenOffice), then upload them to a new file, setting the option to 'convert to google docs'

这篇关于通过API在谷歌驱动器上创建一个新文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 01:12