【发布时间】:2020-07-24 04:30:26
【问题描述】:
我的办公室即将开始制作大量带有特定结构的项目符号列表的 Google 文档。
PART 1 - TEXT HERE
1.1 - TEXT HERE
A. TEXT HERE
1. TEXT HERE
a. TEXT HERE
1) TEXT HERE
(a) TEXT HERE
很遗憾,这与任何默认列表选项都不匹配。
您似乎也无法在每个级别选择编号格式。因此,我正在研究使用 Google Docs API 来应用这种自定义列表格式,并验证/更新现有文档的列表。
Microsoft Word 能够定义新的列表样式,可以在每个级别设置编号。
使用此格式在 Google Docs 中打开 MS Word 文档,然后选择“文件”->“另存为 Google Doc”创建具有所需列表结构的 Google Doc。
因此,Google Docs 能够以我们想要的结构表示列表,但我不希望提出依赖于 Microsoft Word 的工作流程。
当我从 Google Docs API 检索这个测试文档时,我可以在 lists.{listID}.listProperties.nestingLevels 下看到这个自定义列表结构:
[
{
"bulletAlignment": "START",
"glyphType": "DECIMAL",
"glyphFormat": "PART %0 - ",
"indentFirstLine": {
"unit": "PT"
},
"indentStart": {
"magnitude": 18,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "DECIMAL",
"glyphFormat": "%0.%1 - ",
"indentFirstLine": {
"magnitude": 18,
"unit": "PT"
},
"indentStart": {
"magnitude": 36,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "UPPER_ALPHA",
"glyphFormat": "%2.",
"indentFirstLine": {
"magnitude": 36,
"unit": "PT"
},
"indentStart": {
"magnitude": 54,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphSymbol": "●",
"glyphFormat": "%3",
"indentFirstLine": {
"magnitude": 54,
"unit": "PT"
},
"indentStart": {
"magnitude": 72,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "ALPHA",
"glyphFormat": "%4.",
"indentFirstLine": {
"magnitude": 72,
"unit": "PT"
},
"indentStart": {
"magnitude": 90,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "DECIMAL",
"glyphFormat": "%5)",
"indentFirstLine": {
"magnitude": 90,
"unit": "PT"
},
"indentStart": {
"magnitude": 108,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "ALPHA",
"glyphFormat": "(%6)",
"indentFirstLine": {
"magnitude": 108,
"unit": "PT"
},
"indentStart": {
"magnitude": 126,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "DECIMAL",
"glyphFormat": "- ",
"indentFirstLine": {
"magnitude": 126,
"unit": "PT"
},
"indentStart": {
"magnitude": 144,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
},
{
"bulletAlignment": "START",
"glyphType": "DECIMAL",
"glyphFormat": "%8- ",
"indentFirstLine": {
"magnitude": 144,
"unit": "PT"
},
"indentStart": {
"magnitude": 162,
"unit": "PT"
},
"textStyle": {},
"startNumber": 1
}
]
但是,除非我遗漏了什么,否则我看不到任何通过 Google Docs API batchUpdate 更新这些 nestingLevels 的方法。
document.lists只能在create从头开始新建文档时设置。
更新
忽略我之前关于document.create 方法的陈述。该文档非常具有误导性。 “请求正文”部分以:
“请求正文包含具有以下结构的数据:”
随后是整个 document 对象架构和描述每个属性的表。
但是,最顶部是以下注释:
使用请求中给出的标题创建一个空白文档。请求中的其他字段,包括任何提供的内容,都将被忽略。
所以基本上页面上的所有内容都是不敬的。仅使用 title 属性;-(
【问题讨论】:
标签: google-docs-api