How to Insert Values in Specific Excel Cells From DataGridView

May 29 2012 12:59 PM
Hi,
Can you please help me to figure out how I can insert DataGridView values into a pre defined excel template (Into Specific Cells)? I have a DataGridView on my windows Form which is getting the values from user input. Now I would like to enable users to export the DataGridView values into an excel file (A File like attached excel file image). As far as I know I have to create the headers and add them to the code programmatically but for the DataGridView part, honestly I have no idea how I can do that? As you can see the Form (Box) is starting from B2 to K2 and end from B21 to K21 Now my question is how i can start importing values from B4 - k4 and so on? Is there any way I can format the style of the cell (like Background color or font style and size) from C#? I mean generating a form like what is looking in attached Excel programmatically.
Thanks for your time in advance.



Answers (2)