PHP Google 文档 API - 创建选项无效

PHP Google Docs API - create options not working

创建新的 Google 文档时:

    $title = '5 - Testing';
    $opcoes = [
        'title' => $title,
        'documentStyle' => [
            'background' => [ 
                'color' => [
                    'color' => [
                        'rgbColor' => [
                            'red' => 1.0,
                            'green' => 0.0,
                            'blue' => 0.0
                        ]
                    ]
                ] 
            ],
            'pageSize' => [
                'height' => ['magnitude' => 297 * 0.35146, 'unit' => 'PT'],
                'width' => ['magnitude' => 210 * 0.35146, 'unit' => 'PT'],
            ],
            'marginTop' => ['magnitude' => 27 * 0.35146, 'unit' => 'PT'],
            'marginBottom' => ['magnitude' => 15 * 0.35146, 'unit' => 'PT'],
            'marginLeft' => ['magnitude' => 25 * 0.35146, 'unit' => 'PT'],
            'marginRight' => ['magnitude' => 15 * 0.35146, 'unit' => 'PT'],
        ]
    ];
    $documento = new Google_Service_Docs_Document($opcoes);

    try {
        $documento = $this->docService->documents->create($documento);
    } catch (Exception $e) {
        die($e);
    }

文档已创建,但使用默认选项(背景颜色为白色,边距为 2.5 厘米)

我使用 API 资源管理器时结果相同。

知道发生了什么事吗?

问题:

documents.create只能用于创建空白文档并设置其标题:

Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored.

使用批量更新:

必须通过 documents.batchUpdate 对文档进行任何其他自定义。

检查可用更新请求列表here

并且,更具体地说,检查 UpdateDocumentStyleRequest