Is it possible to get access/change the prefix or suffix in a list?

136 views
Skip to first unread message

Vincent Régnier

unread,
Mar 15, 2023, 5:43:32 PM3/15/23
to Google Apps Script Community
I'm looking for a way to access through script to the prefix or suffix of a list in a google doc.
I didn't find any relevant information in apps script guides and I doubt it's possible. Can someone confirm?

Brett Grear

unread,
Mar 16, 2023, 6:05:35 AM3/16/23
to Google Apps Script Community
Do you have a screenshot or example of what you are trying to do?
It doesn't sound that difficult with apps script

Vincent Régnier

unread,
Mar 16, 2023, 2:02:12 PM3/16/23
to Google Apps Script Community
Hi, 
Here is what a standard numbered list looks like in google docs:

1. item1
2. item2
3. item3

it can be generated through apps script and you can access/retrieve/modify each item...

Here is a custom numbered list with a prefix:

Prefix 1. item1
Prefix 2. item2
Prefix 3. item3

I didn't find how to generate such a list with apps script, though it is possible through script to insert additional items based on the LIST_ID if the list was manually started through google docs UI.
Apart from creating such a list from scratch, I would also like to be able to loop through all ListItems in a document and retrieve the "Prefix" to compare with some predefined text.  
I have the feeling that this is some kind of unsupported element but I would like to confirm this.
Regards 

Brett Grear

unread,
Mar 16, 2023, 5:02:47 PM3/16/23
to Google Apps Script Community
I think this can be done on the full Google Docs API but not on the Apps Script DocumentApp.
Reply all
Reply to author
Forward
0 new messages