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
590
Facing issue while Exporting grid to Excel.
posted

Hi

I want a small clarification on one of the use case related to Excel Library

I'm trying to Export the IgrDataGrid and using the following code for that. I'm able to Export the grid but facing issue on styling.

 for (let i = 0; i < gridData.actualCount; i++) {
    var item = gridData.getItemAtIndex(i);
    let row: WorksheetRow = sheet.rows(i + 1);

    Object.entries(item).map(([key, value]) => {
      const columnIndex = columns.indexOf(key);
      if (columnIndex !== -1) {
        row.cells(columnIndex).value = value;
      } else return;
    });
  }
 

I want to know that 

1 - How to set Chip Styling on  specific Cell while Exporting.

2 - How to set the color for specific cell.

3 - How to set the background color for row.

So, for this I need to know how can we achieve that , If there is any solution for this please suggest  as I need to implement this.

Hoping for a positive response.

Thanks!!!

Parents
  • 34810
    Offline posted

    Hello Shubham,

    I have been investigating into the behavior you are looking to achieve in this case, and I have some information for you on this matter. I will address each inquiry below:

    1. I’m not sure I understand what you mean by “Chip Styling” in this case? Would it be possible for you to please provide a screenshot or more description on what you are looking for here?

    2 & 3. There is a cellFormat property on both the WorksheetCell and WorksheetRow object which then exposes a fill property that you can set for this. Using your code above, the following would allow you to color the entire row:

    row.cellFormat.fill = CellFill.createSolidFill("red");

    The same code would work for individual cells, as the cells expose the cellFormat property as well.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children