XLSX Chart position



  • Hello,

    I am attempting to change the position of a chart in Excel, but I'm unsure how to proceed.

    I discovered that the chart's position is located at the path xl/drawings/drawing1.xml, and the relevant element is xdr:twoCellAnchor. I tried modifying xdr:from and xdr:to using xlsxMerge or xlsxReplace, but unfortunately, I did not achieve any results.

    for example:
    {{#xlsxMerge "xl/drawings/drawing1.xml" (replace "xdr:wsDr.xdr:twoCellAnchor.xdr:from.xdr:row" "12" 20)}}
    <c t="inlineStr"><is><t>20</t></is></c>
    {{/xlsxMerge}}

    https://playground.jsreport.net/w/TomiDeak/~avzfgwq

    ![alt text](0_1732113165352_upload-292c0734-0a3e-4afd-a761-804fa4c058a9 image url)

    Do you have any suggestions for this?



  • It looks like our xlsx transformation helpers don't support collons in paths. I've submitted it to the backlog
    https://github.com/jsreport/jsreport/issues/1192

    However, you can do the same in your custom helper

    function updateRow(opts) {
        const drawingJson = opts.data.root.$xlsxTemplate['xl/drawings/drawing1.xml']    
        drawingJson['xdr:wsDr']['xdr:twoCellAnchor'][0]['xdr:from'][0]['xdr:row'][0] = '20'
    }
    

    updated workspace
    https://playground.jsreport.net/w/anon/QFuSeybq



  • Thank you, it helped me a lot.


Log in to reply
 

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