I am making a program that will show you the most commonly used words in your google docs document, and then highlight them. I want to have a menu button that when clicked, will un-highlight everything that is currently highlighted.
I couldn't find anybody who was doing something similar, so I tried doing something like this:
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu("Extra Tools")
.addItem('Clear Highlights', 'clear')
)
.addToUi();
}
function clear()
{
var DocText = DocumentApp.getActiveDocument().getBody().getText();
DocText.getElement().asText.setBackgroundColor("#FFFFFF");
}
but it didn't work, giving me the error "TypeError: Cannot find function getElement in object "
Is there a way to set the highlight/background color of the whole document to white/transparent?