首页 > 解决方案 > 使用 google docs API 添加制表位的正确方法是什么

问题描述

我尝试了以下方法:

{'updateParagraphStyle': {
    'paragraphStyle': {
        'namedStyleType': "NORMAL_TEXT",
        'alignment': "END",
        'direction': "LEFT_TO_RIGHT",
        'borderBottom': {
            'width': {'magnitude': 1.5, 'unit': "PT"},
            'padding': {'magnitude': 1, 'unit': "PT"},
            'dashStyle': "SOLID"
        },
        'tabStops': [
            {
                'offset': {
                    'magnitude': 431.84999999999997,
                    'unit': 'PT'
                },
                'alignment': 'END'
            }
        ],
    },
    'range': {'startIndex': 1, 'endIndex': 10},
    'fields': "tabStops,namedStyleType,alignment,direction,borderBottom"
}}

但它抱怨tabStops

E googleapiclient.errors.HttpError: <HttpError 400 when requesting
https://docs.googleapis.com/v1/documents/1RGkXvV8M321KiuDjbMCQwzc52iEEPRxpFqttKmXnWwQ:batchUpdate?alt=json
returned "Invalid requests[2].updateParagraphStyle: Unallowed field: tabStops". Details: "Invalid
requests[2].updateParagraphStyle: Unallowed field: tabStops">

其他字段工作正常.. 即命名样式类型、对齐、方向、边框底部

标签: python-3.xgoogle-apps-scriptgoogle-docsgoogle-docs-api

解决方案


推荐阅读