I have added in my jqgrid to load the content in descending order. But (using OpenXML) after exporting, my data are not in descending order.
Can anyone help to get the solution?
I have added sortname:'Cust_ID' sortorder: "desc"
under load jqgrid but this mentioned column Cust_ID is hidden in jqgrid. Now I would like to sort the same as my jqgrid
Below if my export to excel function.
`public string ExportReport(int cp, int noOfOrders)
{
string conndb=ConfigurationManager.AppSettings["Db"];
const string Ids ="0";
Company pList = _items.GetByCID(cp);
IQueryable<Product> List
List=product.SQLDatabase().GetListByCompandIds(cp, Convert.ToInt32(noOfOrders), conndb, Ids)
XLWorkbook workbook = new XLWorkbook(XLEventTracking.Disabled);
IXLWorksheet worksheet = workbook.Worksheets.Add("ListReport");
worksheet.Cell(1, 1).Value = "Date";
worksheet.Cell(1, 2).Value = "First Name";
worksheet.Cell(1, 3).Value = "Last Name";
worksheet.Cell(1, 4).Value = "Email";
worksheet.Cell(1, 5).Value = "Department";
worksheet.Cell(1, 6).Value = "Supervisor";
int i = 2;
foreach (EList ExpReport in List)
{
worksheet.Cell(i, 1).SetValue(ExpReport.Date);
worksheet.Cell(i, 2).SetValue(ExpReport.FirstName);
worksheet.Cell(i, 3).SetValue(ExpReport.LastName);
worksheet.Cell(i, 4).SetValue(ExpReport.Email);
worksheet.Cell(i, 5).SetValue(ExpReport.Department);
worksheet.Cell(i, 6).SetValue(ExpReport.Supervisor);
++i;
}
worksheet.Columns().AdjustToContents();
Session["Workbook"] = workbook;
string filename;
filename = "Product-Report";
return filename;
}`