Click here to Skip to main content
15,887,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
One of my C# windows application form has a functionality of downloading the data of entire form in a single excel sheet. The form has few labelboxes at the top which can be accepted as header of the form, in the middle portion of the form there is datagridview which fetches data using a datatable and in the lower part of the form resides footer section which has some textboxes, labelboxes etc. I know how to download data of a datagridview in a excel file, but I need to download the data of entire form(i.e. data of header + datagridview's data + data of footer section) in a single excel with proper formatting and alignment.

What I have tried:

On download button click I can only export the data of gridview in a excel file, but I need to download the data of the entire form.
Posted
Updated 21-Sep-17 20:30pm

1 solution

Pick the required data from the Form and add those in the relevant area in the excel sheet.
ClosedXML[^] would be the best choice to format the data inside the sheet.
refer these
ClosedXML Nicely Formatted Header Row – Justin Cooney[^]
c# - ClosedXML. Adding DataTable to existing Excel worksheet - Stack Overflow[^]
ClosedXML/ClosedXML_Examples at develop · ClosedXML/ClosedXML · GitHub[^]
 
Share this answer
 
Comments
Member 13297587 22-Sep-17 7:56am    
Hi Karthik,
Thanks for your effort, but I didn't get the proper solution of what I was searching.
If possible please send me a worked out example for problem.
Karthik_Mahalingam 22-Sep-17 8:36am    
Hipost the data what you want to add in excel, like a screenshot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900