Altering styles from customize
Altering styles from customize
Hello,
I am trying to add a font to the styles.xml file from the customize function. Currently the fonts section looks like this:
<fonts count="5" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" x14ac:knownFonts="1">
<font><sz val="28" /><name val="Calibri" /></font>
<font><sz val="28" /><name val="Calibri" /><color rgb="FFFFFFFF" /></font>
<font><sz val="28" /><name val="Calibri" /><b /></font>
<font><sz val="28" /><name val="Calibri" /><i /></font>
<font><sz val="28" /><name val="Calibri" /><u /></font></fonts>
Here is what I have tried so far:
var style = xlsx.xl['styles.xml'];
//change font count and add font
$('fonts', style).attr('count', 6);
$('fonts', style).append('<font><sz val="28" /><name val="Calibri" /><b /></font>');
//change styles count and and style
$('cellXfs', style).attr('count', 68);
$('cellXfs', style).append('<xf numFmtId="0" borderId="0" fillId="0" fontId="5" applyBorder="1" applyFill="1" applyFont="1" />');
//edit cell style
$('c[r=D1]', sheet).attr('s', '67');
The attribute line worked just as it would when editing a sheet.xml file, but append did not.
My end goal is to add a new font type and a new style type so I can make a specific cell have larger font than the standard size 11. I know this would be easier if I downloaded the source files and edited them, but for now I want to try and solve this within 'customize'. Any help is greatly appreciated.
Thanks,
Joe
Answers
As a side note, because I know the
.attr()
function is working, I can probably replace styles I'm not using with the ones I need. That seems more messy than adding new ones, but it is doable.