check in all the work is good to go now.
This commit is contained in:
@@ -33,37 +33,75 @@ namespace CarParkValidationAPI.Repository
|
||||
SLDocument sl = new SLDocument();
|
||||
|
||||
|
||||
//first sheetName
|
||||
sl.RenameWorksheet(SLDocument.DefaultFirstSheetName, "ConcessionValidation");
|
||||
SLStyle style = sl.CreateStyle();
|
||||
style.SetFontUnderline(DocumentFormat.OpenXml.Spreadsheet.UnderlineValues.Single);
|
||||
style.SetFontBold(true);
|
||||
style.SetFont("Arial Black", 16);
|
||||
sl.SetCellStyle(1, 5, style);
|
||||
sl.SetRowHeight(1, 1, 25);
|
||||
sl.SetCellValue(row++, 5, "The ConssionValidation Report");
|
||||
|
||||
sl.SetCellValue(1, 8, " " + DateTime.Now.ToString("ddd dd/MM/yyyy HH:mm"));
|
||||
|
||||
int startTitleRow = 3;
|
||||
row = startTitleRow;
|
||||
//make the title bold
|
||||
style = sl.CreateStyle();
|
||||
style.Font.Bold = true;
|
||||
sl.SetRowStyle(startTitleRow, style);
|
||||
//set it height
|
||||
sl.SetRowHeight(startTitleRow, startTitleRow, 25);
|
||||
// add the title first
|
||||
sl.SetCellValue(row, col++, "Date");
|
||||
sl.SetCellValue(row, col++, "Concession Card");
|
||||
sl.SetCellValue(row, col++, "Concession Holder");
|
||||
sl.SetCellValue(row, col++, "ConcessionExpiry");
|
||||
sl.SetCellValue(row, col++, "Is Concession Expiry");
|
||||
sl.SetCellValue(row, col++, "ConcessionType");
|
||||
sl.SetCellValue(row, col++, "ValidationPiont");
|
||||
sl.SetCellValue(row, col++, "Validation Piont");
|
||||
sl.SetCellValue(row, col++, "StaffLink No");
|
||||
sl.SetCellValue(row, col++, "Staff first name");
|
||||
sl.SetCellValue(row, col++, "Staff last name");
|
||||
sl.SetCellValue(row, col++, "Staff Email");
|
||||
//wrap text on is concession Expiry
|
||||
style = sl.CreateStyle();
|
||||
style.SetWrapText(true);
|
||||
sl.SetColumnStyle(4, style);
|
||||
|
||||
//format date
|
||||
|
||||
SLStyle style = sl.CreateStyle();
|
||||
style.FormatCode = "dd/mm/yyyy hh:mm:ss";
|
||||
sl.SetColumnStyle(1, style);
|
||||
style = sl.CreateStyle();
|
||||
style.Font.Bold = true;
|
||||
sl.SetRowStyle(1, style);
|
||||
|
||||
style.FormatCode = "dd/mm/yyyy";
|
||||
sl.SetColumnStyle(1, style);
|
||||
//make column width
|
||||
sl.SetColumnWidth(1, 20);
|
||||
sl.SetColumnWidth(2, 18);
|
||||
sl.SetColumnWidth(3, 25);
|
||||
sl.SetColumnWidth(4, 20);
|
||||
sl.SetColumnWidth(5, 30);
|
||||
sl.SetColumnWidth(6, 40);
|
||||
sl.SetColumnWidth(7, 20);
|
||||
sl.SetColumnWidth(8, 20);
|
||||
sl.SetColumnWidth(9, 20);
|
||||
sl.SetColumnWidth(10, 20);
|
||||
int startRowFrom = startTitleRow+1;
|
||||
var list = await _context.SelectConcessionValidationByDate(true, fromDate.ToLocalTime(), toDate.ToLocalTime());
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
col = 1;
|
||||
item = list[i];
|
||||
row = i + 2;
|
||||
row = i + startRowFrom;
|
||||
sl.SetCellValue(row, col++, item.ValidateDate);
|
||||
sl.SetCellValue(row, col++, item.ConcessionCard);
|
||||
sl.SetCellValue(row, col++, item.ConcessionHolder);
|
||||
sl.SetCellValue(row, col++, item.ConcessionExpiry);
|
||||
sl.SetCellValue(row, col++, item.ConcessionExpiry ? "Yes": "No");
|
||||
sl.SetCellValue(row, col++, item.ConcessionType);
|
||||
sl.SetCellValue(row, col++, item.ValidationPiont);
|
||||
sl.SetCellValue(row, col++, item.ValidationPoint);
|
||||
sl.SetCellValue(row, col++, item.StafflinkNo);
|
||||
sl.SetCellValue(row, col++, item.StaffFirstName);
|
||||
sl.SetCellValue(row, col++, item.StaffLastName);
|
||||
sl.SetCellValue(row, col++, item.StaffEmail);
|
||||
}
|
||||
byte[] array;
|
||||
// sl.SaveAs("C:\\Temp\\Report\\ConcessionValidationDate" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx");
|
||||
@@ -82,7 +120,6 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
}
|
||||
|
||||
|
||||
var result = new FileContent
|
||||
{
|
||||
Content = array,
|
||||
@@ -90,8 +127,6 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
return new ResultModel<FileContent>
|
||||
{
|
||||
Data = result,
|
||||
|
||||
Reference in New Issue
Block a user