Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
c# code to give Gridview cell name to exporting Excel file
Bineesh VP
Feb 4 2017 7:25 AM
217
Reply
Sir,
I am in winForm project in which I have to export datagridview data into excel sheet.
I have done almost except naming exported excel header columns to that of datagridview.
How can I set column headers to the exported excel file..help me
for (int i = 0; i < dgvBankAllocationReport.Rows.Count; i++)
{
for (int j = 0; j < dgvBankAllocationReport.Columns.Count; j++)
{
if (dgvBankAllocationReport.Rows[i].Cells[j].Value != null)
{
exceObj.Cells[i + 2, j + 1] = dgvBankAllocationReport.Rows[i].Cells[j].Value;
string colName = dgvBankAllocationReport.Columns[j].HeaderText;
}
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Ddelete in Gridview without using AutoGenerateDeleteButton
how to insert data using oracle data base in mvc4/5 ?