Home > Software design >  Export Excel Range to DataGridView maintaining cell formatting and formulas
Export Excel Range to DataGridView maintaining cell formatting and formulas

Time:03-01

I'm working with Spire.XLS and I have to populate an excel file with different sheets, then the problem begins, I need to take out values from different sheets and export those together in the same dataGridView, to take the values I use the method sheet.Range[], it seems like spire.XLS as the command exportDataTable(), but in this case it shows something like this

And the problem with this one is that this doesn't maintain the cell background color nor the actual value of the formula in the last col, I'm open to other libraries as well if needed, but I need to figure this problem out

CodePudding user response:

There is no direct method to export Excel formatting to DataGridView, you may write plenty of code to translate the Excel formatting to a DataGridView. If you want to export the actual value of the formula instead of the formula itself, you can use the enter image description here

The output DataGridView: enter image description here

  • Related