Images in Excel Exports

Posted by: joe on 21 June 2018, 7:44 pm EST

  • Posted 21 June 2018, 7:44 pm EST

    I’m currently developing a custom excel export using the xlsx converter and I want to include a company graphic in the file. Is there a way to assign a graphic (.png) to a cell in the workbook? I’ve read the docs and see there’s no image type but…

    Thanks!

    Joe

  • Posted 21 June 2018, 8:27 pm EST

    Also, is there a way to define borders for cells and rows?

    If no to all of my questions, is it possible to send the xlsxConverter HTML for it to convert to an excel doc?

  • Posted 22 June 2018, 8:04 am EST

    Hi,

    We are sorry, currently, images are not supported during excel I/O.

    For changing border style and color you can pass a formatItem function to the FlexGridXlsxConverter.save() method.

    Please refer to following code snippet

    var wb=wijmo.grid.xlsx.FlexGridXlsxConverter.save(grid,{
    	formatItem:(xlsxFormatItemArgs)=>{
    		var cellBorder=xlsxFormatItemArgs.xlsxCell.style.borders;
    		        cellBorder.left=cellBorder.left?cellBorder.left:{};
    			cellBorder.right=cellBorder.right?cellBorder.right:{};
    			cellBorder.top=cellBorder.top?cellBorder.top:{};
    			cellBorder.bottom=cellBorder.bottom?cellBorder.bottom:{};
    			cellBorder.left.color="pink";
    			cellBorder.left.style=wijmo.xlsx.BorderStyle.MediumDashed;
    			cellBorder.right.color="green";
    	}
    });
    console.log(wb);
    wb.save('samplewb.xlsx');
    

    Here is a sample of the same:- https://stackblitz.com/edit/js-yb59pj?file=index.js

    ~Manish

  • Posted 23 June 2018, 5:28 pm EST

    Thanks for the reply, Manish. But i’m not using the flexgrid. This is a straight from data to the xlsx converter. Unless you think I should use a grid object to format the output?

  • Posted 25 June 2018, 11:13 pm EST

    Hi,

    If you are using FlexGrid or already have an instance of Workbook/WorkSheet, you may iterate cells/columns and change style as required.

    PS: **Cells style is given preference over column style.

    Please refer to following updated sample for the same:-

    https://stackblitz.com/edit/js-d456lx?file=index.js

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels