Syntax for adding xlsx col properties - escaping double quotes?

  • Hi,

    I am attempting to add a col element to an xlsx sheet to define custom column widths.

    This works:

    0_1677825346331_Screen Shot 2023-03-03 at 5.35.27 pm.png

    The first two columns are wider.

    What need to do it add these cols dynamically, from an object in the script colWidths that has two properties, the index and width I want to set the column to.

    0_1677825538867_Screen Shot 2023-03-03 at 5.38.51 pm.png

    This does not work, and I assume that it has to do with the double quotes, but I can't wrap the {{values}} in double quotes as that does not work in handlebars.

    Any ideas?



  • Seems to work fine for me

    {{#xlsxReplace "xl/worksheets/sheet1.xml" "worksheet.cols"}}
            {{#each colWidths}}
                <col min="{{index}}" max="{{index}}" width="{{width}}" customWidth="1" />

  • So it does, thanks for the confirmation

Log in to reply

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