3
Answers

Excel report: error in code

kavita

kavita

18y
3.5k
1

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)