0

I would like a way to highlight all of the superscripts that indicate footnotes, so that it's easier to see the footnote in a paragraph when skimming with your eyes. The goal is something like this:

enter image description here

I can't find any way to do this manually, or any add-on that will do this for me. Is there some way to do this with a script?

I tried the answer here Google Script: interacting with footnotes but it changes the style body of the footnotes without changing the style of superscript numbers themselves. I want to be able to format the superscripts all at once, but separately from the footnote bodies.

Tanaike
204k12 gold badges126 silver badges222 bronze badges
asked Nov 17, 2023 at 15:09

1 Answer 1

1

Unfortunately, I couldn't find a method for managing the style of the superscript numbers of the footnotes from the Google Document service (DocumentApp). I'm worried that in the current stage, there might be no method for directly changing the superscript numbers of the footnotes in the methods of Google Document service. But, fortunately, I thought that when Google Docs API is used, your goal can be achieved. In this answer, I would like to propose a sample script using Docs API.

Sample script:

Before you use this script, please enable Google Docs API at Advanced Google services.

function myFuction() {
 const doc = DocumentApp.getActiveDocument();
 const docId = doc.getId();
 const obj = Docs.Documents.get(docId);
 const requests = obj.body.content.reduce((ar, e) => {
 if (e.paragraph) {
 e.paragraph.elements.forEach(f => {
 if (f.footnoteReference) {
 ar.push({ updateTextStyle: { textStyle: { backgroundColor: { color: { rgbColor: { red: 0, green: 1, blue: 0 } } } }, range: { startIndex: f.startIndex, endIndex: f.endIndex }, fields: "backgroundColor" } });
 }
 });
 }
 return ar;
 }, []);
 if (requests.length == 0) return;
 Docs.Documents.batchUpdate({ requests }, docId);
}

Testing:

When this script is run, the following result is obtained.

enter image description here

Note:

  • In this sample, it supposes that from your showing image, only the paragraphs are checked. If the superscript numbers of the footnotes exist in other parts except for the paragraphs, please modify the above script.

References:

answered Nov 18, 2023 at 0:37
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.