kavita

kavita

  • NA
  • 131
  • 143.2k

Excel report: error in code

Dec 28 2006 1:17 AM

Hi this is kavita,

can anybody tell me what wrong inthis code :
Excel.Application ex = new Excel.Application();
 Excel.Workbook wb = ex.Workbooks.Add(Type.Missing);

 Excel.Worksheet ws = Excel.Worksheets[1]; //ERROR IN THIS LINE//////

Excel.Range r = ws.get_Range("A1",Type.Missing); r.Value2 = "From Russia With Love";
 r.Font.Bold = true; r.Interior.ColorIndex = 6; ex.Visible = true;

actually I want to fetch data from sql table & show in Excel report.What is the cirrect code ?
please help me!


Answers (3)