TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Madhav Sharma
889
899
39.3k
How to export the web grid data in excel in formatted manner
Nov 24 2017 6:07 AM
How to export the web grid data in excel with formatted manner
After importing excel data is not coming in formatted manner
WebGrid grid =
new
WebGrid(model.TicketReportDataModel, rowsPerPage: model.PageSize, canPage:
true
);
string
gridData = grid.GetHtml(
columns: grid.Columns(
grid.Column(columnName:
"ticketNo"
, header:
"Ticket No"
, canSort:
false
),
grid.Column(columnName:
"Summary"
, header:
"Title"
, canSort:
false
),
grid.Column(columnName:
"Contact_Name"
, header:
"Contact"
, canSort:
false
),
grid.Column(columnName:
"SR_Status"
, header:
"Status"
, canSort:
false
),
grid.Column(columnName:
"Site_Name"
, header:
"Site Name"
, canSort:
false
),
grid.Column(columnName:
"SR_Type_Description"
, header:
"Type"
, canSort:
false
),
grid.Column(columnName:
"Company"
, header:
"Company"
, canSort:
false
),
grid.Column(columnName:
"Board"
, header:
"Board"
, canSort:
false
),
grid.Column(columnName:
"Discussion"
, header:
"Discussion"
, canSort:
false
),
grid.Column(columnName:
"Resolution"
, header:
"Resolution"
, canSort:
false
),
grid.Column(columnName:
"SubType_Description"
, header:
"SubType"
, canSort:
false
),
grid.Column(columnName:
"Date_Entered"
, header:
"Date Entered"
, canSort:
false
))).ToString();
//ExcelPackage pk = new ExcelPackage();
Response.ClearContent();
Response.AddHeader(
"content-disposition"
,
"attachment; filename=TicketList.xls"
);
//Response.ContentType = "applicatiom/vnd.ms-excel";
Response.ContentType =
"application/octet-stream"
;
Response.Write(gridData);
Response.End();
Reply
Answers (
1
)
How to capitalize first character after dot (.) and
Upload file using jquery ajax asp.net c# MVC , sql server db