Example #1
0
        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[0, 0] = "Ячейка";
            data[0, 1] = "№";
            data[0, 2] = "Муз. №.";
            data[0, 3] = "МО";

            for (int i = 0; i < obj.MICList.Count; i++)
            {
                data[0, 4 + i] = obj.MICList[i];
            }

            data[0, 4 + obj.MICList.Count] = "МПК";

            for (int i = 0; i < obj.MOList.Count; i++)
            {
                data[1 + i, 0] = obj.MOList[i].Cell;
                data[1 + i, 1] = obj.MOList[i].Number;
                data[1 + i, 2] = obj.MOList[i].MuseumNumber;
                data[1 + i, 3] = obj.MOList[i].MO;
            }

            data[1 + obj.MOList.Count, 0] = "Контрольн.МО";

            for (int i = 0; i < obj.ControlMOList.Count; i++)
            {
                data[2 + obj.MOList.Count + i, 0] = obj.ControlMOList[i].Cell;
                data[2 + obj.MOList.Count + i, 1] = obj.ControlMOList[i].Number;
                data[2 + obj.MOList.Count + i, 2] = obj.ControlMOList[i].MuseumNumber;
                data[2 + obj.MOList.Count + i, 3] = obj.ControlMOList[i].MO;
            }

            return(data);
        }
Example #2
0
        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[1, 1], sheet.Cells[1 + obj.MOList.Count, obj.MICList.Count + 5]]);
            sheet.PageSetup.Zoom           = false;
            sheet.PageSetup.FitToPagesWide = 1;
            //   sheet.PageSetup.FitToPagesTall = 0;
            //Formatting Control MO Header
            sheet.Range[sheet.Cells[2 + obj.MOList.Count, 1], sheet.Cells[2 + obj.MOList.Count, obj.MICList.Count + 5]].Merge();
            sheet.Range[sheet.Cells[2 + obj.MOList.Count, 1], sheet.Cells[2 + obj.MOList.Count, obj.MICList.Count + 5]].RowHeight = 15;
            FormatHeaderControlMOText1(
                sheet.Range[
                    sheet.Cells[2 + obj.MOList.Count, 1], sheet.Cells[2 + obj.MOList.Count, obj.MICList.Count + 5]]);



            // Formatting table with control MO
            FormatTableCells1(sheet.Range[sheet.Cells[1 + obj.MOList.Count + 1, 1], sheet.Cells[1 + obj.MOList.Count + 1 + obj.ControlMOList.Count, obj.MICList.Count + 5]]);
            FormatHeaderControlMOText1(sheet.Range[
                                           sheet.Cells[3 + obj.MOList.Count, 2], sheet.Cells[1 + obj.MOList.Count + obj.ControlMOList.Count, 4]]);
            //Formatting Top Row
            sheet.Range[sheet.Cells[1, 1], sheet.Cells[5, obj.MICList.Count + 5]].ColumnWidth = 6;
            //Formatting Left Columns
            sheet.Range[sheet.Cells[1, 1], sheet.Cells[5 + obj.MOList.Count, 1]].ColumnWidth = 6;
            sheet.Range[sheet.Cells[1, 2], sheet.Cells[5 + obj.MOList.Count, 2]].ColumnWidth = 8;
            sheet.Range[sheet.Cells[1, 3], sheet.Cells[5 + obj.MOList.Count, 3]].ColumnWidth = 8;
            sheet.Range[sheet.Cells[1, 4], sheet.Cells[5 + obj.MOList.Count, 4]].ColumnWidth = 14;
            //Formatting Right Columns
            sheet.Range[sheet.Cells[1, obj.MICList.Count + 5], sheet.Cells[1 + obj.MOList.Count, obj.MICList.Count + 5]].ColumnWidth = 8;


            sheet.Cells[obj.MOList.Count + obj.ControlMOList.Count + 3, 2] = "Проверил:";

            // Разбиваем на две части
            if (obj.MOList.Count > 48)
            {
                sheet.ResetAllPageBreaks();
                // sheet.DisplayPageBreaks = true;
                sheet.HPageBreaks.Add(sheet.Cells[50, 1]);
            }
        }