Hi guys, I have below code to generate excel sheet, its working fine in my local system and when im hosted in server its saying Object reference error, Can ny helpme out
if (ds.Tables[0].Rows.Count > 0)
{
CreateExcelDoc exceldoc = new CreateExcelDoc();
#region creates the main header
exceldoc.createHeaders(2, 6, "NAME OF THE INST", "F1", "I1", 0, "", true, 15, "");
exceldoc.createHeaders(3, 6, "LOCATION, LOCATION-521165,LOCATION District", "F2", "I2", 0, "", true, 10, "");
exceldoc.addData(6, 6, ds.Tables[0].Rows[0]["1"].ToString(), "A" + 6 + "", "A" + 6 + "", "");
exceldoc.addData(6, 7, ds.Tables[0].Rows[0]["2"].ToString(), "A" + 6 + "", "A" + 6 + "", "");
exceldoc.addData(6, 8, ds.Tables[0].Rows[0]["3"].ToString(), "A" + 6 + "", "A" + 6 + "", "");
exceldoc.addData(6, 9, ds.Tables[0].Rows[0]["4"].ToString(), "A" + 6 + "", "A" + 6 + "", "");
exceldoc.addData(10, 6, "Name", "A" + 6 + "", "A" + 6 + "", "");
exceldoc.addData(10, 7, "Marks", "A" + 6 + "", "A" + 6 + "", "");
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
exceldoc.addData(i + 11, 6, ds.Tables[0].Rows[i]["5"].ToString(), "A" + (i + 11), "A" + (i + 11), "");
exceldoc.addData(i + 11, 7, ds.Tables[0].Rows[i]["6"].ToString(), "A" + (i + 11), "A" + (i + 11), "");
}
}
exceldoc.app.Visible = true;
#endregion
}