node.js - 如何在 google docs api 中自定义页边距?

标签 node.js google-docs-api google-apis-explorer

我尝试自定义页面大小和边距,但不起作用。 我曾尝试在网站中使用自动 API,但结果仍然没有改变边距。 Google 文档 API 有任何变化吗?

enter image description here

最佳答案

不幸的是,现阶段似乎无法用documents.create的方法设置documentStylecontentRef我确认这仍然没有被修改。那么作为当前的解决方法,以下流程怎么样?

流程:

  1. 使用documents.create方法创建新的Document。在这种情况下,可以设置标题。

  2. 使用documents.batchUpdate方法设置updateDocumentStyle

    • 根据您的问题,documents.batchUpdate的请求正文如下。

      {
        "requests": [
          {
            "updateDocumentStyle": {
              "documentStyle": {
                "marginTop": {
                  "magnitude": 100,
                  "unit": "PT"
                },
                "marginLeft": {
                  "magnitude": 500,
                  "unit": "PT"
                }
              },
              "fields": "marginTop,marginLeft"
            }
          }
        ]
      }
      

引用文献:

如果这不是您想要的方向,我深表歉意。

关于node.js - 如何在 google docs api 中自定义页边距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60145800/

相关文章:

ios - GDataServiceGoogleDocs

google-sheets-api - google-api-ruby-client:批量更新电子表格值

css - 在nodejs中包含外部css文件

ios - 谷歌云端硬盘 iOS : Upload HTML file to overwrite an existing Docs file

css - 自定义自动 HTML 电子邮件

java - 如何通过 google api 库(例如 people api)或带有服务帐户凭据的 REST 通过 google 电子邮件获取用户信息(account_id)?

google-cloud-platform - GCP Cloud Scheduler API 问题

Javascript:动态声明函数的正确方法

node.js - 多个 NodeJS 服务器的多个 redis 实例

node.js - 如何修复 : Type 'Window' is not assignable to type 'typeof globalThis'