1
votes

My office about to start producing a large number of Google Docs with bulleted lists in a particular structure.

PART 1 - TEXT HERE
1.1 - TEXT HERE
    A. TEXT HERE
        1. TEXT HERE
            a. TEXT HERE
                1) TEXT HERE
                    (a) TEXT HERE

Unfortunately, this does not match any of the default list options.

enter image description here

Nor does it seem like you can select the numbering format at each level. So I'm looking into using the Google Docs API to both apply this custom list format, and validate/update the lists of existing documents.

Microsoft Word has the ability to define a new list style where the numbering can be set at each level.

enter image description here

Opening a MS Word doc in Google Docs with this formatting, and choosing File->Save As Google Doc creates a Google Doc with the desired list structure.

enter image description here

So Google Docs is capable of representing a list with the structure we desire, but I'd prefer to not propose a workflow that depends on Microsoft Word.

When I retrieve this test document from the Google Docs API I can see this custom list structure under 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
    }
]
  

However, unless I'm missing something I do not see any way to update these nestingLevels through the Google Docs API batchUpdate.

The document.lists can only set when createing a new document from scratch.

UPDATE

Ignore my previous statement above about the document.create method. The documentation is very misleading. The "Request Body" section begins with:

"The request body contains data with the following structure:"

Which is followed with the entire document object schema and a table that describes each property.

However, at the very top is the following note:

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

So basically everything on the page is irreverent. Only the title property is used ;-(

1

1 Answers

1
votes

After replicating your issue I came to the conclusion that you are correct with your findings. To allow creating lists with documents.batchUpdate I opened a feature request in IssueTracker. You could open it and leave a star so it gets more popular in the Google engineers eyes.