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
rachayita jaiswal
NA
217
106.4k
Export data from textbox to excel without using database
Aug 8 2013 2:20 AM
Hi,
I want to export data from textbox to excelsheet without using database or gridview.
I have created like this -
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook xlWB;
Microsoft.Office.Interop.Excel.Worksheet xlWS;
Microsoft.Office.Interop.Excel.Range xlRng;
string workbookPath = "D:\\New Microsoft Office Excel Worksheet.xls";
protected void btnexcel_Click(object sender, EventArgs e)
{
xlApp.Workbooks.Open(workbookPath, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
int colIndex = 0;
string addTNumbers = txtname.Text;
xlWS.Cells[1, 1] = addTNumbers;
//Save the file to where you specified
xlWB.Save();
xlApp.Visible = true;
}
but i am getting error on "xlWS.Cells[1, 1] = addTNumbers;" line that object reference not set to an instance.
Please tell me, how to get this.
Reply
Answers (
17
)
Asp.net MVC2
RowDataBound Event...