我正在寻找页脚中的段落和元素段落的示例。
我尝试过,但只能在页脚中插入文本:
$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);
我们可以管理页脚段落吗?
我认为你不能插入AutoText https://developers.google.com/docs/api/reference/rest/v1/documents#autotext通过API。没有有效的来自批量更新的请求 https://developers.google.com/docs/api/reference/rest/v1/documents/request可以用于此目的(通过插入的文本插入文本请求 https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest必须是一个字符串)。结果,PAGE_NUMBER
and PAGE_COUNT
只能通过 UI 设置:如果您使用 API,则只能检索它们。
我建议您在以下位置提交功能请求此问题跟踪器组件 https://issuetracker.google.com/components/555502关于这个问题。
参考:
- AutoText https://developers.google.com/docs/api/reference/rest/v1/documents#autotext
- 文档.batchUpdate https://developers.google.com/docs/api/reference/rest/v1/documents/request
- 插入文本请求 https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)