Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
Export to Excel using multiple sheets
posted

Hi Team,

We are developing a screen where user should be able to download data to Excel of multiple components in the page. The components can be charts, tables or anything. Ideally each of them will be having a json data in the angular model.

Now our requirement needs the following:

  1. Export data into a single Excel file but each component data into multiple sheets.
  2. Formatting the data with a nice information at the top in multiple rows which explains what the data is about and then the table. Also it will be good if we can add our company logo at the top of each sheet.

Looking forward to your help.

Thanks

Parents Reply
  • 1560
    Offline posted in reply to Rameez Sadikot

    Hello,

    An approach I could suggest is to use WorksheetImage. In its constructor, you need to pass a base64 string of the required image. Afterward, you need to set its position and add it to the Worksheet shapes collection. For example:

     const wb = new Workbook(WorkbookFormat.Excel2007);
        const imageSheet = wb.worksheets().add('Image');
        const img = new WorksheetImage(this.imageBase64);
        img.topLeftCornerCell = imageSheet.rows(0).cells(0);
        img.topLeftCornerPosition = new Point(0, 0);
        img.bottomRightCornerCell = imageSheet.rows(2).cells(2);
        img.bottomRightCornerPosition = new Point(50, 50);
        img.setBoundsInTwips(imageSheet, img.getBoundsInTwips());
        imageSheet.shapes().add(img);
        this.wb = wb;

    Please test it on your side and let me know if I may be of any further assistance.


    Sincerely,
    Teodosia Hristodorova
    Software Developer

Children