Reputation: 695
How can the background color of a document element be removed (aka set to null)?
I've tried setting the value to "null", however, the system gives me this error: "We're sorry, a server error occurred. Please wait a bit and try again. (line 14)"
If I comment line 14 (activeSel.setBackgroundColor) out the script works fine
function clearDoc(){
var doc = DocumentApp.openById(DOC1Id);
var activeSel = doc.getActiveSection().getParagraphs()[2];
var attr = activeSel.getAttributes(); // BACKGROUND_COLOR = "#ff0000"
activeSel.setBackgroundColor(null); // errors out
return
}
Upvotes: 1
Views: 3184
Reputation: 26
Setting BACKGROUND_COLOR to null (or using setBackgroundColor
) now clears the background color. The example given above no longer errors out.
Upvotes: 1
Reputation: 12673
Have you tried setting the background color to white ("#ffffff")?
Upvotes: 0