/// <summary>
        /// Создать новый подзаголовок
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <returns></returns>
        private TableRow NewSubtitle(TablesRow NewRow)
        {
            UInt32 RowHeight        = 284U;
            int    LeftIndentation  = -113;
            int    RightIndentation = -113;
            JustificationValues JustificationValue = JustificationValues.Center;
            int      FontSize = 11;
            TableRow tableRow = CalibrationLib.NewTableRow(RowHeight);

            int[] CellWidthValues = GetCellWidthValues(NewRow);

            TableCell TableCell1 = tableRow.AddTableCell(CellWidthValues[0], NewRow.Values[0], LeftIndentation, RightIndentation, JustificationValue, FontSize, NewRow.GridSpan[0]);

            TableCell1.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            TableCell TableCell2 = tableRow.AddTableCell(CellWidthValues[1], NewRow.Values[1], LeftIndentation, RightIndentation, JustificationValue, FontSize, NewRow.GridSpan[1]);

            TableCell2.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            TableCell TableCell3 = tableRow.AddTableCell(CellWidthValues[2], NewRow.Values[2], LeftIndentation, RightIndentation, JustificationValue, FontSize, NewRow.GridSpan[2]);

            TableCell3.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            TableCell TableCell4 = tableRow.AddTableCell(CellWidthValues[3], NewRow.Values[3], LeftIndentation, RightIndentation, JustificationValue, FontSize, NewRow.GridSpan[3]);

            TableCell4.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            return(tableRow);
        }
        /// <summary>
        /// Сформировать таблицу с данными измерений датчика.
        /// </summary>
        /// <param name="ParentDocument"> Родительский документ (из которого выгружаются данные). </param>
        /// <param name="SensorsNumber"> Заводской номер датчика. </param>
        /// <returns></returns>
        public Table GetSensorsTable(WordprocessingDocument ParentDocument, string SensorsNumber)
        {
            const int TableWidth = 9782;

            int[] ColumnsWidth = new int [] { 1277, 284, 1275, 5103, 1666, 177 };

            Table            table     = CalibrationLib.NewTable(ColumnsWidth);
            List <TablesRow> TableRows = GetRows(ParentDocument, SensorsNumber);

            TableRow tableRow1 = CalibrationLib.NewTableRow((UInt32Value)198U);

            tableRow1.AddTableCell(ColumnsWidth[0], TableRows[0].Values[0], -113, -113, JustificationValues.Right, 8, 1, true, true);
            tableRow1.AddTableCell(ColumnsWidth[1], TableRows[0].Values[1], -113, -113, JustificationValues.Center, 8, 1, true, true);
            tableRow1.AddTableCell(ColumnsWidth[2], TableRows[0].Values[2], -113, -113, JustificationValues.Center, 8, 1, true, true).SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Single, BorderValues.Nil);
            tableRow1.AddTableCell(ColumnsWidth[3] + ColumnsWidth[4] + ColumnsWidth[5], TableRows[0].Values[3], -113, -113, JustificationValues.Left, 8, 3, true, true);

            TableRow tableRow2 = CalibrationLib.NewTableRow((UInt32Value)198U);

            tableRow2.AddTableCell(ColumnsWidth[0] + ColumnsWidth[1] + ColumnsWidth[2] + ColumnsWidth[3], TableRows[1].Values[0], -113, -113, JustificationValues.Left, 8, 4);
            tableRow2.AddTableCell(ColumnsWidth[4] + ColumnsWidth[5], TableRows[1].Values[1], -113, -113, JustificationValues.Center, 12, 2, false, true).SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Dotted, BorderValues.Nil);

            table.Append(tableRow1);
            table.Append(tableRow2);

            return(table);
        }
        /// <summary>
        /// Создать шапку таблицы.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <param name="TableWidth"> Ширина столбца. </param>
        /// <returns></returns>
        internal TableRow CreateHeader(TablesRow NewRow, int[] ColumnsWidthList)
        {
            TableRow NewTableRow = CalibrationLib.NewTableRow((UInt32Value)284U);

            for (int i = 0; i < NewRow.ColumnsCount; i++)
            {
                TableCell NewTableCell = NewTableRow.AddTableCell(ColumnsWidthList[i], NewRow.Values[i], -113, -113, JustificationValues.Center, 12,
                                                                  NewRow.GridSpan[i], false, false, NewRow.VerticalMerge[i]);
                NewTableCell.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            }
            return(NewTableRow);
        }
        /// <summary>
        /// Создать заголовок таблицы.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <param name="TableWidth"> Ширина столбца. </param>
        /// <returns></returns>
        internal TableRow CreateTitle(TablesRow NewRow, int TableWidth)
        {
            TableRow NewTableRow = CalibrationLib.NewTableRow((UInt32Value)284U);

            for (int i = 0; i < NewRow.ColumnsCount; i++)
            {
                TableCell NewTableCell = NewTableRow.AddTableCell(TableWidth / NewRow.ColumnsCount, NewRow.Values[i], -113, -113, JustificationValues.Left, 12,
                                                                  ColumnsCount, false, false);
                NewTableCell.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Nil, BorderValues.Nil);
            }
            return(NewTableRow);
        }
示例#5
0
        /// <summary>
        /// Создать новую результирующую строку.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <returns></returns>
        private TableRow NewResult(TablesRow NewRow)
        {
            UInt32   RowHeight        = 284U;
            int      LeftIndentation  = -57;
            int      RightIndentation = -57;
            int      FontSize         = 10;
            TableRow tableRow         = CalibrationLib.NewTableRow(RowHeight);

            int[] CellWidthValues = GetCellWidthValues(NewRow);

            TableCell TableCell1 = tableRow.AddTableCell(CellWidthValues[0], NewRow.Values[0], LeftIndentation, RightIndentation, JustificationValues.Left, FontSize, NewRow.GridSpan[0]);

            TableCell1.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Nil, BorderValues.Nil);
            TableCell TableCell2 = tableRow.AddTableCell(CellWidthValues[1], NewRow.Values[1], LeftIndentation, RightIndentation, JustificationValues.Center, FontSize, NewRow.GridSpan[1]);

            TableCell2.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Single, BorderValues.Nil);
            TableCell TableCell3 = tableRow.AddTableCell(CellWidthValues[2], NewRow.Values[2], LeftIndentation, RightIndentation, JustificationValues.Left, FontSize, NewRow.GridSpan[2]);

            TableCell3.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Nil, BorderValues.Nil);
            return(tableRow);
        }
        /// <summary>
        /// Создать результирующую строку таблицы.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <param name="TableWidth"> Ширина столбца. </param>
        /// <returns></returns>
        internal TableRow CreateResult(TablesRow NewRow, int TableWidth)
        {
            TableRow NewTableRow = CalibrationLib.NewTableRow((UInt32Value)198U);

            for (int i = 0; i < NewRow.ColumnsCount; i++)
            {
                TableCell NewTableCell = NewTableRow.AddTableCell(TableWidth / NewRow.ColumnsCount, NewRow.Values[i], -113, -113, JustificationValues.Center, 8,
                                                                  NewRow.GridSpan[i], false, true, NewRow.VerticalMerge[i]);
                NewTableCell.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Nil, BorderValues.Nil);
            }
            return(NewTableRow);
        }
        /// <summary>
        /// Создать подзаголовок таблицы.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <param name="TableWidth"> Ширина столбца. </param>
        /// <returns></returns>
        internal TableRow CreateSubTitle(TablesRow NewRow, int TableWidth)
        {
            TableRow NewTableRow = CalibrationLib.NewTableRow((UInt32Value)198U);

            for (int i = 0; i < NewRow.ColumnsCount; i++)
            {
                TableCell NewTableCell = NewTableRow.AddTableCell(TableWidth / NewRow.ColumnsCount, NewRow.Values[0], -113, -113, JustificationValues.Center, 8,
                                                                  ColumnsCount, false, true);
                NewTableCell.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            }
            return(NewTableRow);
        }
        /// <summary>
        /// Создать обычную строку таблицы.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <param name="TableWidth"> Ширина столбца. </param>
        /// <returns></returns>
        internal TableRow CreateSimpleRow(TablesRow NewRow, int[] ColumnsWidthList)
        {
            TableRow NewTableRow = CalibrationLib.NewTableRow((UInt32Value)198U);

            for (int i = 0; i < NewRow.ColumnsCount; i++)
            {
                bool      Italic       = i == 0 ? false : true;
                TableCell NewTableCell = NewTableRow.AddTableCell(ColumnsWidthList[i], NewRow.Values[i], -113, -113, JustificationValues.Center, 8,
                                                                  NewRow.GridSpan[i], false, Italic, NewRow.VerticalMerge[i]);
                NewTableCell.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            }
            return(NewTableRow);
        }
        /// <summary>
        /// Создать новую шапку таблицы.
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <returns></returns>
        private TableRow NewHeader(TablesRow NewRow)
        {
            UInt32 RowHeight        = 284U;
            int    LeftIndentation  = -113;
            int    RightIndentation = -113;
            JustificationValues JustificationValue = JustificationValues.Left;
            int      FontSize = 11;
            TableRow tableRow = CalibrationLib.NewTableRow(RowHeight);

            int[] CellWidthValues = GetCellWidthValues(NewRow);

            TableCell TableCell1 = tableRow.AddTableCell(CellWidthValues[0], NewRow.Values[0], LeftIndentation, RightIndentation, JustificationValue, FontSize, NewRow.GridSpan[0]);

            TableCell1.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Nil, BorderValues.Nil);
            return(tableRow);
        }
示例#10
0
 private void BuildTableRowElement(TableRow tableRow, XmlNode tableRowNode, XmlAttributeCollection fontAttrs)
 {
     foreach (XmlNode child in tableRowNode)
     {
         switch (child.Name)
         {
         case "tablecell":
             tableRow.AddTableCell(BuildTableCell(child, fontAttrs));
             break;
         }
         if (child.Name == "font" && child.HasChildNodes)
         {
             BuildTableRowElement(tableRow, child, child.Attributes);
         }
     }
 }
示例#11
0
 static void InsertLineForClient(this Table table, int Index, string Text)
 {
     try
     {
         TableRow  newTableRow = CalibrationLib.NewTableRow();
         int       CellWidth1  = 10065;
         TableCell TableCell1  = newTableRow.AddTableCell(CellWidth1, Text, -113, -113, JustificationValues.Left, 12, 12);
         TableCell1.SetBorders(BorderValues.Nil, BorderValues.Nil, BorderValues.Single, BorderValues.Nil);
         List <OpenXmlElement> NewList = table.Elements().ToList();
         NewList.Insert(Index, newTableRow);
         table.RemoveAllChildren();
         foreach (OpenXmlElement Element in NewList)
         {
             table.Append(Element);
         }
     }
     catch { }
 }
        /// <summary>
        /// Создать обычную строку
        /// </summary>
        /// <param name="NewRow"> Строка таблицы. </param>
        /// <returns></returns>
        private TableRow NewSimpleRow(TablesRow NewRow)
        {
            UInt32 RowHeight        = 284U;
            int    LeftIndentation  = -113;
            int    RightIndentation = -113;
            JustificationValues JustificationValue = JustificationValues.Center;
            int      FontSize = 11;
            TableRow tableRow = CalibrationLib.NewTableRow(RowHeight);

            int[] CellWidthValues = GetCellWidthValues(NewRow);

            for (int i = 0; i < NewRow.Values.Count(); i++)
            {
                TableCell tableCell = tableRow.AddTableCell(CellWidthValues[i], NewRow.Values[i], LeftIndentation, RightIndentation, JustificationValue, FontSize, NewRow.GridSpan[i]);
                tableCell.SetBorders(BorderValues.Single, BorderValues.Single, BorderValues.Single, BorderValues.Single);
            }
            return(tableRow);
        }