猿问

如何在页脚中插入PAGE_NUMBER和PAGE_COUNT

我正在寻找页脚中的段落和元素段落的示例。我试过了,但我只能在页脚中插入文本:


$requests = array (new \Google_Service_Docs_Request(array(

    'insertText' => array(

        'location' => array(

            'segmentId' => $segmentId,

                'index' => 0

            ),

            "text" => 'My Text'

        )

)),

我试图像这样实现新的页脚:


$footers = array(

        new \Google_Service_Docs_Footer(array(

            'footerId' => $segmentId,

            'content' => [

                'paragraph' => [

                    'element' => [

                        'textRun' => [

                            'content' => 'My Text - '

                        ]

                    ]

                ]

            ]

        )),

        new \Google_Service_Docs_Footer(array(

            'footerId' => $segmentId,

            'content' => [

                  'paragraph' => [

                      'element' => [

                          'AutoText' => [

                              'type' => 'PAGE_NUMBER'

                          ]

                      ]

                  ]

            ]

        )),

        new \Google_Service_Docs_Footer(array(

            'footerId' => $segmentId,

            'content' => [

                'paragraph' => [

                    'element' => [

                        'AutoText' => [

                            'type' => 'PAGE_COUNT'

                        ]

                    ]

                ]

            ]

        ))

    );

    $document->setFooters($footers);

我们可以管理页脚的段落吗?


斯蒂芬大帝
浏览 113回答 2
2回答

白猪掌柜的

我不认为您可以通过API插入自动图文集。没有来自批处理更新的有效请求可用于此(通过插入文本请求插入的文本必须是字符串)。因此,只能通过 UI 进行设置:如果您使用的是 API,则只能检索它们。PAGE_NUMBERPAGE_COUNT我建议您在此问题跟踪器组件中提交有关此问题的功能请求。参考:自动图文集文档.批处理更新插入文本请求

慕的地6264312

问题正在进行中 https://issuetracker.google.com/issues/149275293 我有反馈时请与您保持联系
随时随地看视频慕课网APP
我要回答