2

I try to custom my page size and margin but it doesn't working. I had try to used the auto API in the site but the result still not change the margin. Is there any change in the google docs api?

enter image description here

1 Answer 1

3

Unfortunately, in the current stage, it seems that documentStyle and content cannot be set with the method of documents.create. Ref I confirmed that this has still not been modified. So as the current workaround, how about the following flow?

Flow:

  1. Create new Document using the method of documents.create. In this case, the title can be set.

  2. Set updateDocumentStyle using the method of documents.batchUpdate.

    • From your question, the request body for documents.batchUpdate is as follows.

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

References:

If this was not the direction you want, I apologize.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.