private static object[,] PrepareListForSet1(SetItem obj) { var rowsCount = obj.MOList.Count + 8 + obj.ControlMOList.Count + 1; var columnsCount = obj.MICList.Count + 5; object[,] data = new object[rowsCount, columnsCount]; data[0, 0] = "Метод тестирования: " + obj.TestMethod; data[2, 0] = "Сет № " + obj.Set; data[2, 4] = obj.AB; data[4, 0] = "Ячейка"; data[4, 1] = "№"; data[4, 2] = "Муз. №."; data[4, 3] = "МО"; for (int i = 0; i < obj.MICList.Count; i++) { data[4, 4 + i] = obj.MICList[i]; } data[4, 4 + obj.MICList.Count] = "МПК"; for (int i = 0; i < obj.MOList.Count; i++) { data[5 + i, 0] = obj.MOList[i].Cell; data[5 + i, 1] = obj.MOList[i].Number; data[5 + i, 2] = obj.MOList[i].MuseumNumber; data[5 + i, 3] = obj.MOList[i].MO; } data[5 + obj.MOList.Count, 0] = "Контрольн.МО"; for (int i = 0; i < obj.ControlMOList.Count; i++) { data[6 + obj.MOList.Count + i, 0] = obj.ControlMOList[i].Cell; data[6 + obj.MOList.Count + i, 1] = obj.ControlMOList[i].Number; data[6 + obj.MOList.Count + i, 2] = obj.ControlMOList[i].MuseumNumber; data[6 + obj.MOList.Count + i, 3] = obj.ControlMOList[i].MO; } return(data); }
private static object[,] PrepareListForSet1(SetItem obj) { var rowsCount = obj.MOList.Count + 8 + obj.ControlMOList.Count + 1; var columnsCount = obj.MICList.Count + 5; object[,] data = new object[rowsCount, columnsCount]; data[0, 0] = "Метод тестирования: " + obj.TestMethod; data[2, 0] = "Сет № " + obj.Set; data[2, 4] = obj.AB; data[4, 0] = "Ячейка"; data[4, 1] = "№"; data[4, 2] = "Муз. №."; data[4, 3] = "МО"; for (int i = 0; i < obj.MICList.Count; i++) { data[4, 4 + i] = obj.MICList[i]; } data[4, 4 + obj.MICList.Count] = "МПК"; for (int i = 0; i < obj.MOList.Count; i++) { data[5 + i, 0] = obj.MOList[i].Cell; data[5 + i, 1] = obj.MOList[i].Number; data[5 + i, 2] = obj.MOList[i].MuseumNumber; data[5 + i, 3] = obj.MOList[i].MO; } data[5 + obj.MOList.Count, 0] = "Контрольн.МО"; for (int i = 0; i < obj.ControlMOList.Count; i++) { data[6 + obj.MOList.Count + i, 0] = obj.ControlMOList[i].Cell; data[6 + obj.MOList.Count + i, 1] = obj.ControlMOList[i].Number; data[6 + obj.MOList.Count + i, 2] = obj.ControlMOList[i].MuseumNumber; data[6 + obj.MOList.Count + i, 3] = obj.ControlMOList[i].MO; } return data; }
private static void FormatSheetForSet1(Excel.Worksheet sheet, SetItem obj) { // formatting All sheet sheet.PageSetup.PrintGridlines = false; sheet.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait; sheet.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4; sheet.PageSetup.RightFooter = "Дата: &DD Стр &PP из &NN"; sheet.PageSetup.RightHeader = "Исследование " + obj.Project + ", сет № " + obj.Set + " - " + obj.TestMethod + " - " + obj.AB; sheet.PageSetup.Zoom = false; sheet.PageSetup.LeftHeader = "НИИ Антимикробной химиотерапии"; sheet.PageSetup.TopMargin = 50; sheet.PageSetup.BottomMargin = 50; sheet.PageSetup.HeaderMargin = 20; sheet.PageSetup.FooterMargin = 20; sheet.PageSetup.RightMargin = 10; sheet.PageSetup.LeftMargin = 50; sheet.PageSetup.Order = Excel.XlOrder.xlOverThenDown; // Foramatting test method sheet.Range[sheet.Cells[1, 1], sheet.Cells[1, obj.MICList.Count + 5]].Merge(); FormatHeaderText1(sheet.Range[sheet.Cells[1, 1], sheet.Cells[1, 3]]); // Formatting Set Number sheet.Range[sheet.Cells[3, 1], sheet.Cells[3, 4]].Merge(); FormatHeaderText1(sheet.Range[sheet.Cells[3, 1], sheet.Cells[3, 1]]); // Formatting Set Number sheet.Range[sheet.Cells[3, 5], sheet.Cells[3, obj.MICList.Count + 5]].Merge(); FormatHeaderText1(sheet.Range[sheet.Cells[3, 5], sheet.Cells[3, obj.MICList.Count + 5]]); //Formatting table with MO FormatTableCells1(sheet.Range[sheet.Cells[5, 1], sheet.Cells[5 + obj.MOList.Count, obj.MICList.Count + 5]]); //Formatting Control MO Header sheet.Range[sheet.Cells[6 + obj.MOList.Count, 1], sheet.Cells[6 + obj.MOList.Count, obj.MICList.Count + 5]].Merge(); sheet.Range[sheet.Cells[6 + obj.MOList.Count, 1], sheet.Cells[6 + obj.MOList.Count, obj.MICList.Count + 5]].RowHeight = 15; FormatHeaderControlMOText1( sheet.Range[ sheet.Cells[6 + obj.MOList.Count, 1], sheet.Cells[6 + obj.MOList.Count, obj.MICList.Count + 5]]); // Formatting table with control MO FormatTableCells1(sheet.Range[sheet.Cells[5 + obj.MOList.Count + 1, 1], sheet.Cells[5 + obj.MOList.Count + 1 + obj.ControlMOList.Count, obj.MICList.Count + 5]]); FormatHeaderControlMOText1(sheet.Range[ sheet.Cells[7 + obj.MOList.Count, 2], sheet.Cells[6 + obj.MOList.Count + obj.ControlMOList.Count, 4]]); //Formatting Top Row sheet.Range[sheet.Cells[5, 1], sheet.Cells[5, obj.MICList.Count + 5]].ColumnWidth = 6; //Formatting Left Columns sheet.Range[sheet.Cells[5, 1], sheet.Cells[5 + obj.MOList.Count, 1]].ColumnWidth = 6; sheet.Range[sheet.Cells[5, 2], sheet.Cells[5 + obj.MOList.Count, 2]].ColumnWidth = 8; sheet.Range[sheet.Cells[5, 3], sheet.Cells[5 + obj.MOList.Count, 3]].ColumnWidth = 8; sheet.Range[sheet.Cells[5, 4], sheet.Cells[5 + obj.MOList.Count, 4]].ColumnWidth = 14; //Formatting Right Columns sheet.Range[sheet.Cells[5, obj.MICList.Count + 5], sheet.Cells[5 + obj.MOList.Count, obj.MICList.Count + 5]].ColumnWidth = 8; sheet.Cells[obj.MOList.Count + obj.ControlMOList.Count + 10, 2] = "Проверил:"; sheet.PageSetup.PrintTitleRows = "$5:$5"; sheet.PageSetup.PrintTitleColumns = "$A:$Z"; sheet.PageSetup.PrintArea = "$A$1:" + sheet.Cells[obj.MOList.Count + obj.ControlMOList.Count + 10, 5 + obj.MICList.Count].Address; }
private static void CreateMicTable(Document doc, SetItem itemSet, Section section, out Table table, out Row row, out Cell cell) { table = new Table(); table.Borders.Width = "0.015cm"; int i = 0; int cntr = 0; //Add CEll, Number, MusNumber, Organism to table //CEll var column = table.AddColumn("0.8cm"); column.Format.Alignment = ParagraphAlignment.Center; // MusNumber column = table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; // Organism column = table.AddColumn("1.8cm"); column.Format.Alignment = ParagraphAlignment.Center; // Mic var micCount = itemSet.MICList.Count; double micWidth = ((doc.DefaultPageSetup.PageWidth.Centimeter - 5.5*(section.PageSetup.LeftMargin.Centimeter + section.PageSetup.RightMargin.Centimeter) ) / micCount); for (int j = 0; j < micCount ; j++) { column = table.AddColumn(micWidth.ToString() + "cm"); column.Format.Alignment = ParagraphAlignment.Center; } // Total Mic column = table.AddColumn("1.8cm"); column.Format.Alignment = ParagraphAlignment.Center; //Add header row row = table.AddRow(); row.Height = "0.4cm"; row.HeadingFormat = true; row.Borders.Bottom.Width = "0.05cm"; cell = row.Cells[0]; cell.AddParagraph("Ячейка"); cell.VerticalAlignment = VerticalAlignment.Center; cell = row.Cells[1]; cell.AddParagraph("Муз.№"); cell.VerticalAlignment = VerticalAlignment.Center; cell = row.Cells[2]; cell.AddParagraph("МО"); cell.VerticalAlignment = VerticalAlignment.Center; for (int j = 0; j < micCount ; j++) { cell = row.Cells[3 + j]; cell.VerticalAlignment = VerticalAlignment.Center; cell.AddParagraph(itemSet.MICList[j].ToString()); } cell = row.Cells[3 + micCount]; cell.VerticalAlignment = VerticalAlignment.Center; cell.AddParagraph("МПК"); }
private static void CreateMicTable(Document doc, SetItem itemSet, Section section, out Table table, out Row row, out Cell cell) { table = new Table(); table.Borders.Width = "0.015cm"; int i = 0; int cntr = 0; //Add CEll, Number, MusNumber, Organism to table //CEll var column = table.AddColumn("0.8cm"); column.Format.Alignment = ParagraphAlignment.Center; // MusNumber column = table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; // Organism column = table.AddColumn("1.8cm"); column.Format.Alignment = ParagraphAlignment.Center; // Mic var micCount = itemSet.MICList.Count; double micWidth = ((doc.DefaultPageSetup.PageWidth.Centimeter - 5.5 * (section.PageSetup.LeftMargin.Centimeter + section.PageSetup.RightMargin.Centimeter)) / micCount); for (int j = 0; j < micCount; j++) { column = table.AddColumn(micWidth.ToString() + "cm"); column.Format.Alignment = ParagraphAlignment.Center; } // Total Mic column = table.AddColumn("1.8cm"); column.Format.Alignment = ParagraphAlignment.Center; //Add header row row = table.AddRow(); row.Height = "0.4cm"; row.HeadingFormat = true; row.Borders.Bottom.Width = "0.05cm"; cell = row.Cells[0]; cell.AddParagraph("Ячейка"); cell.VerticalAlignment = VerticalAlignment.Center; cell = row.Cells[1]; cell.AddParagraph("Муз.№"); cell.VerticalAlignment = VerticalAlignment.Center; cell = row.Cells[2]; cell.AddParagraph("МО"); cell.VerticalAlignment = VerticalAlignment.Center; for (int j = 0; j < micCount; j++) { cell = row.Cells[3 + j]; cell.VerticalAlignment = VerticalAlignment.Center; cell.AddParagraph(itemSet.MICList[j].ToString()); } cell = row.Cells[3 + micCount]; cell.VerticalAlignment = VerticalAlignment.Center; cell.AddParagraph("МПК"); }