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
diana onea
NA
8
17.1k
C# Import Excel - XlWBATemplate.XlWBATWorksheet Error
Jun 20 2011 11:42 AM
Hello,
I am trying to create a new Excel file with a blank sheet.
My code is the following :
using Excel = Microsoft.Office.Interop.Excel;
public void format()
{
List<string> sheets = getSheetName(path);
Excel._Application xlsAppNew = new Excel.Application();
xlsAppNew.Visible = true;
foreach (string s in sheets)
{
if (s.Contains("A,B") == true)
{
char[] delim = { 'A' };
string[] grupa = s.Split(delim, 4);
listView1.Items.Add(grupa[0] + "A");
Excel.Workbook workbook = Excel.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Excel.Sheets newSheet = workbook.Worksheets;
listView1.Items.Add(grupa[0] + "B");
//save in another sheet
}
else
listView1.Items.Add(s.ToString());
//save in another sheet
}
}
But I get the following error : The name 'XlWBATemplate' does not exist in the current context.
What`s missing?
Please help.
Reply
Answers (
2
)
Can't access the file. It might be in use .. Zune software error
RadHtmlPlaceHolder in silver light