How to add styling to cell (font color,size,background color etc) to XLSX

  • How can I go about adding custom styling to the row/cell? I see that I can do <c s="9" r="E{{#sum items.length }}{{/sum}}" t="str"><f>SUM(E2:E{{#getPPSubtotal}}{{/getPPSubtotal}})</f></c> and if I change it to s="3" for example, it will change the color, but where could I define that?

  • administrators

    hi @jabren unfortunately i don't have any specific recommendation here.

    you will need some knowledge about how Open XML stores styles in order to do what you want, i recommend to you read this to know what is the format, where should they live, and how to apply the styles.

  • @bjrmatos Could please tell me how can I add styles.xml? I need that file to define new styles.

  • Ok, I've found a solution. We have to replace styles.xml file with our own definition.

    {{#xlsxReplace "xl/styles.xml"}}
      <stylesheet xmls="">
    {{#xlsxReplace "xl/styles.xml"}}`

  • even after I added <fill>..... I still don't know how to apply it to cell:
    <c t="inlineStr" fillId="3" ><is><t>{{val}}</t></is></c>
    is not the way to go :(

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.