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
60
Export to excel excel sheet is in different color
posted

HI Team,

After exporting igx - grid  to excel . The excel is background color is in blue and white color as per our application constancy i need to display in white color . Could you please  help me in this . please find attached screen shots expected and actual  result.

Thanks

Vikram

  • 460
    Offline posted

    Hello, Vikram

    I have been looking into your question and after an investigation I have determined that by design when you are using the IgxExcelExporterService the grid is exported as table with default design. In order to export the data in different format or use different table design I could suggest using our Excel Library and create a custom button in the grid's toolbar similar to the default which would create a new workbook with the required content on click.

    In order to use the Excel Library you need to add the following dependencies: "file-saver", "igniteui-angular-core" and "igniteui-angular-excel" as well as the Excel Utility class.

    Afterwards, you could load the grid's data into worksheet and export it to Excel without creating a table which would look similar to the attached screenshot. A sample illustrating my suggestion could be found here.

    If you need to create excel table with such content my suggestion is to create a WorksheetTable and set its style in order to display the data depending on your requirement my suggestion is using the following approach which I left as comment in the attached sample:

    worksheet.tables().add("A1:D" + (this.localData.length + 1), true, workbook.standardTableStyles().item("TableStyleLight1"));
    worksheet.tables(0).displayBandedRows = false;

    Please test it on your side and let me know if you need any further assistance with this matter.

    Regards,

    Georgi Anastasov

    Software Developer

    Infragistics