Background: Company is updating the style and I've made an addon that should update existing documents to the current style-profile.
Solution: A Google App Script [add-on] reads the right formating from a template-document and updates the active document to mirror it.
Snippet: This don't work correctly
var deltaAttri = [
"BACKGROUND_COLOR",
"FOREGROUND_COLOR",
"FONT_FAMILY",
"FONT_SIZE",
"SPACING_AFTER",
"SPACING_BEFORE"
];
var baseAttr = heading1.getAttributes();
var templateAttri = templateHeading1.getAttributes();
for(var d = 0;d<deltaAttri.length;d++){
baseAttr[deltaAttri[d]] = templateAttri [deltaAttri[d]];
}
heading1.setAttributes(baseAttr);
Problem: Almost every attribute i fetch ( heading1.getAttributes() ) is null.
Heading1={
FONT_SIZE=null,
SPACING_BEFORE=null,
SPACING_AFTER=null,
FOREGROUND_COLOR=#073763,
FONT_FAMILY=null,
BACKGROUND_COLOR=null
}
Am I doing this wrong or is this outside the scipe of what to use App Script for?
I initially thought null ment the default value was set. If so, can I access/change the default?
Here's something I did with an Envelope Printer recently. It's a fairly standard way of loading an object.