Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

406
Visualizações
PHP Google Docs API - create options not working

When a new Google Doc is create:

    $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);
    }

The doc is created but with the default options (background color white, margins 2.5cm)

Same result when I use API explorer.

Any idea what's going on?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Issue:

documents.create can only be used to create a blank document and set its title:

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

Use batchUpdate:

Any other customization of the document has to be made via documents.batchUpdate.

Check the list of available update requests here.

And, more specifically, check UpdateDocumentStyleRequest.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda