/// <summary>
        /// Добавить новую таблицу в документ
        /// </summary>
        /// <param name="Protocol">Документ протокола.</param>
        /// <param name="NewTable">Объект таблицы.</param>
        /// <param name="InsertElement">Объект документа, перед которым требуется вставить таблицу.</param>
        static void AddNewTable(WordprocessingDocument Protocol, Table NewTable, OpenXmlElement InsertElement)
        {
            InsertElement.InsertBeforeSelf(CalibrationLib.NewParagraph(-113, -133, JustificationValues.Left, 11));
            InsertElement.InsertBeforeSelf((OpenXmlElement)NewTable);

            /*if (Protocol.MainDocumentPart.Document.Body.Elements<Table>().Count() > 0)
             * {
             *
             *  List<OpenXmlElement> NewList = Protocol.MainDocumentPart.Document.Body.Elements().ToList();
             *  int Index = NewList.Count - 4;
             *  NewList.Insert(Index, CalibrationLib.NewParagraph(-113, -133, JustificationValues.Left, 11));
             *  NewList.Insert(Index, (OpenXmlElement)NewTable);
             *  Protocol.MainDocumentPart.Document.Body.RemoveAllChildren();
             *  foreach (OpenXmlElement Element in NewList)
             *  { Protocol.MainDocumentPart.Document.Body.Append(Element); }
             *
             *
             * }
             * else
             * {
             *  SdtBlock Block = Protocol.MainDocumentPart.Document.Body.Elements<SdtBlock>().First();
             *  SdtContentBlock ContentBlock = Block.Elements<SdtContentBlock>().First();
             *  List<OpenXmlElement> NewList = ContentBlock.Elements().ToList();
             *  int Index = NewList.Count - 4;
             *  NewList.Insert(Index, CalibrationLib.NewParagraph(-113, -133, JustificationValues.Left, 11));
             *  NewList.Insert(Index, (OpenXmlElement)NewTable);
             *  ContentBlock.RemoveAllChildren();
             *  foreach (OpenXmlElement Element in NewList)
             *  { ContentBlock.Append(Element); }
             * }*/
        }
Esempio n. 2
0
        static void AddTitle(WordprocessingDocument Certificate)
        {
            Paragraph paragraph = CalibrationLib.NewParagraph(-284, 141, JustificationValues.Center, 8);
            Run       run       = CalibrationLib.NewRun(14);

            run.Append(CalibrationLib.NewText("Действительные значения метрологических характеристик"));
            paragraph.Append(run);
            Certificate.MainDocumentPart.Document.Body.Append(paragraph);
            Certificate.MainDocumentPart.Document.Body.Append(CalibrationLib.NewParagraph(0, 0, JustificationValues.Center, 8));
        }
 static void AddNewTable(WordprocessingDocument Protocol, Table NewTable, OpenXmlElement InsertElement)
 {
     InsertElement.InsertBeforeSelf(CalibrationLib.NewParagraph(-113, -133, JustificationValues.Left, 10));
     InsertElement.InsertBeforeSelf((OpenXmlElement)NewTable);
 }