i have excell report coding but coming error

Posted by Venky.Net under Silverlight on 7/17/2012 | Points: 10 | Views : 1299 | Status : [Member] | Replies : 0
hi this error This operation is not supported in the current context.
dynamic excelApp = null;
excelApp = AutomationFactory.CreateObject("Excel.Application");
dynamic workbook = excelApp.workbooks;
workbook.Add();
dynamic sheet = excelApp.ActiveSheet;
dynamic cell = null;
int index = 1;

foreach (Orderdetail ord in ven.ItemsSource)
{

cell = sheet.Cells[index, 1];
cell.Value = ord.OrderRecdate;
cell = sheet.Cells[index, 2];
cell.Value = ord.CompanyName;
cell = sheet.Cells[index, 3];
cell.Value = ord.Typeofaddress;
cell = sheet.Cells[index, 4];
cell.Value = ord.Product;
cell = sheet.Cells[index, 5];
cell.Value = ord.ProductPrice;
cell = sheet.Cells[index, 6];
cell.Value = ord.Discount;
cell = sheet.Cells[index, 7];
cell.Value = ord.NetPrice;
cell = sheet.Cells[index, 8];
cell.Value = ord.Subscriptionfrom;
cell = sheet.Cells[index, 9];
cell.Value = ord.Subscriptionto;
cell = sheet.Cells[index, 10];
cell.Value = ord.Salesby;
cell = sheet.Cells[index, 11];
cell.Value = ord.BankName;
cell = sheet.Cells[index, 12];
cell.Value = ord.BankLocation;
cell = sheet.Cells[index, 13];
cell.Value = ord.ChequeNo; ;
cell = sheet.Cells[index, 14];
cell.Value = ord.DDNo;
cell = sheet.Cells[index, 15];
cell.Value = ord.BankNames;
index++;




Responses

(No response found.)

Login to post response