public override void Generate(bool show) { #if !NETSTANDARD fPath = AppHost.StdDialogs.GetSaveFile("Excel files (*.xls)|*.xls"); if (string.IsNullOrEmpty(fPath)) { return; } Workbook workbook = new Workbook(); Worksheet worksheet = new Worksheet("First Sheet"); IProgressController progress = AppHost.Progress; progress.ProgressInit(LangMan.LS(LSID.LSID_MIExport) + "...", fTree.RecordsCount); var dateFormat = GlobalOptions.Instance.DefDateFormat; try { worksheet.Cells[1, 1] = new Cell("№"); worksheet.Cells[1, 2] = new Cell(LangMan.LS(LSID.LSID_Surname)); worksheet.Cells[1, 3] = new Cell(LangMan.LS(LSID.LSID_Name)); worksheet.Cells[1, 4] = new Cell(LangMan.LS(LSID.LSID_Patronymic)); worksheet.Cells[1, 5] = new Cell(LangMan.LS(LSID.LSID_Sex)); worksheet.Cells[1, 6] = new Cell(LangMan.LS(LSID.LSID_BirthDate)); worksheet.Cells[1, 7] = new Cell(LangMan.LS(LSID.LSID_DeathDate)); worksheet.Cells[1, 8] = new Cell(LangMan.LS(LSID.LSID_BirthPlace)); worksheet.Cells[1, 9] = new Cell(LangMan.LS(LSID.LSID_DeathPlace)); worksheet.Cells[1, 10] = new Cell(LangMan.LS(LSID.LSID_Residence)); worksheet.Cells[1, 11] = new Cell(LangMan.LS(LSID.LSID_Age)); worksheet.Cells[1, 12] = new Cell(LangMan.LS(LSID.LSID_LifeExpectancy)); ushort row = 1; int num = fTree.RecordsCount; for (int i = 0; i < num; i++) { GDMRecord rec = fTree[i]; if (rec.RecordType == GDMRecordType.rtIndividual) { GDMIndividualRecord ind = (GDMIndividualRecord)rec; if (fSelectedRecords == null || fSelectedRecords.IndexOf(rec) >= 0) { var parts = GKUtils.GetNameParts(ind); string sx = "" + GKUtils.SexStr(ind.Sex)[0]; row++; worksheet.Cells[row, 1] = new Cell(ind.GetXRefNum()); worksheet.Cells[row, 2] = new Cell(parts.Surname); worksheet.Cells[row, 3] = new Cell(parts.Name); worksheet.Cells[row, 4] = new Cell(parts.Patronymic); worksheet.Cells[row, 5] = new Cell(sx); worksheet.Cells[row, 6] = new Cell(GKUtils.GetBirthDate(ind, dateFormat, false)); worksheet.Cells[row, 7] = new Cell(GKUtils.GetDeathDate(ind, dateFormat, false)); worksheet.Cells[row, 8] = new Cell(GKUtils.GetBirthPlace(ind)); worksheet.Cells[row, 9] = new Cell(GKUtils.GetDeathPlace(ind)); worksheet.Cells[row, 10] = new Cell(GKUtils.GetResidencePlace(ind, fOptions.PlacesWithAddress)); worksheet.Cells[row, 11] = new Cell(GKUtils.GetAge(ind, -1)); worksheet.Cells[row, 12] = new Cell(GKUtils.GetLifeExpectancy(ind)); } } progress.ProgressStep(); } workbook.Worksheets.Add(worksheet); workbook.Save(fPath); #if !CI_MODE if (show) { ShowResult(); } #endif } finally { progress.ProgressDone(); } #endif }