for i:=0 to length(emp_v)-1 do begin
MyWorksheet.WriteText(i+ExcelRowShift, 0, emp_v[i].surname+' '+emp_v[i].forename);
MyWorksheet.WriteBorders(i+ExcelRowShift, 0, [cbNorth, cbSouth,cbWest, cbEast]);
MyWorksheet.WriteText(i+ExcelRowShift, 1, emp_v[i].position);
MyWorksheet.WriteBorders(i+ExcelRowShift, 1, [cbNorth, cbSouth,cbWest, cbEast]);
MyWorksheet.WriteRowHeight(ExcelRowShift-1,ExcelHeaderRowHeight,suMillimeters);
for cert_count:=0 to Length(cert_v)-1 do begin
if i=0 then begin
MyWorksheet.WriteWordwrap(ExcelRowShift-1,cert_count+ExcelColShift,true);
MyWorksheet.WriteHorAlignment(ExcelRowShift-1, cert_count+ExcelColShift, haCenter);
MyWorksheet.WriteVertAlignment(ExcelRowShift-1, cert_count+ExcelColShift, vaCenter);
MyWorksheet.WriteFontStyle(i+ExcelRowShift-1, cert_count+ExcelColShift,[fssBold]);
MyWorksheet.WriteBorders(i+ExcelRowShift-1, cert_count+ExcelColShift, [cbNorth, cbSouth,cbWest, cbEast]);
MyWorksheet.WriteText(i+ExcelRowShift-1, cert_count+ExcelColShift, cert_v[cert_count].description);
end;
for j:=0 to Length(cert_d)-1 do begin
if (emp_v[i].id=cert_d[j].empid) and (cert_v[cert_count].id=cert_d[j].id) then begin
MyWorksheet.WriteText(i+ExcelRowShift, cert_count+ExcelColShift, cert_d[j].date_expired);
MyWorksheet.WriteBorders(i+ExcelRowShift, cert_count+ExcelColShift, [cbNorth, cbSouth,cbWest, cbEast]);
if length(cert_d[j].date_expired)<>0 then begin
cmp:=comparedate(strtodate(cert_d[j].date_expired),test_date);
if cmp<0 then
MyWorksheet.WriteBackgroundColor(i+ExcelRowShift,cert_count+ExcelColShift, clRed);
end;
{Inc(FProgress);
StatusBar1.Panels.Items[1].Text := IntToStr(FProgress); //init a redraw
Application.ProcessMessages;}
end
else begin
MyWorksheet.WriteBorders(i+ExcelRowShift, cert_count+ExcelColShift, [cbNorth, cbSouth,cbWest, cbEast]);
end;
end;
end;
end;
MyWorkbook.WriteToFile(MyDir + 'CO-HSE-Matrix.xls', sfExcel8, true);