I have four different SPs and need to generate four sheets in Excel. The first three sheets are generated, but when it comes to generating the 4th sheet, the system will return index was out of range exception.
dt = crm.GetAllCrmInquiry(Convert.ToInt32(userid), txtdate.Text.ToString(), txttodate.Text.ToString()); Workbook book = new Workbook(); Worksheet sheet = book.Worksheets[0]; sheet.Name = "All Inquiry"; sheet.InsertDataTable(dt, true, 1, 1);
dt = crm.GetFollupDetail(); sheet = book.Worksheets[1]; sheet.Name = "FollowUp"; sheet.InsertDataTable(dt, true, 1, 1);
dt = crm.GetOpenInquiry_With_FollupDetail(); sheet = book.Worksheets[2]; sheet.Name = "Open Inquiry with FollowUp"; sheet.InsertDataTable(dt, true, 1, 1);
dt = crm.Get_Sample_Requisition_Inquiry_Detail(txtdate.Text, txttodate.Text); sheet = book.Worksheets[3]; sheet.Name = "Sample Requition"; sheet.InsertDataTable(dt, true, 1, 1); book.SaveToFile("D:\\Supporting Documents\\CRM ALL Inquiry.xlsx", ExcelVersion.Version2016);