Esempio n. 1
0
        // Creates an TableCell instance and adds its children.
        public static void AddSpacerCell(this TableRow row, string width = "173")
        {
            TableCell tableCell1 = new TableCell();

            TableCellProperties tableCellProperties1 = new TableCellProperties();
            TableCellWidth      tableCellWidth1      = new TableCellWidth()
            {
                Width = width, Type = TableWidthUnitValues.Dxa
            };

            tableCellProperties1.Append(tableCellWidth1);

            Paragraph paragraph1 = new Paragraph()
            {
                RsidParagraphAddition = "005A43FA", RsidParagraphProperties = "005A43FA", RsidRunAdditionDefault = "005A43FA"
            };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            Indentation         indentation1         = new Indentation()
            {
                Left = "95", Right = "95"
            };

            paragraphProperties1.Append(indentation1);

            paragraph1.Append(paragraphProperties1);

            tableCell1.Append(tableCellProperties1);
            tableCell1.Append(paragraph1);
            row.Append(tableCell1);
        }
        //.....................................................................
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private static TableCellProperties MakeCellStyle_0101( )
        {
            TableCellProperties tableCellProperties1 = new TableCellProperties( );
            TableCellWidth      tableCellWidth1      = new TableCellWidth( )
            {
                Width = "2840", Type = TableWidthUnitValues.Dxa
            };

            TableCellBorders tableCellBorders1 = new TableCellBorders( );
            BottomBorder     bottomBorder1     = new BottomBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )48U, Space = ( UInt32Value )0U
            };
            RightBorder rightBorder1 = new RightBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )18U, Space = ( UInt32Value )0U
            };

            tableCellBorders1.Append(bottomBorder1);
            tableCellBorders1.Append(rightBorder1);

            tableCellProperties1.Append(tableCellWidth1);
            tableCellProperties1.Append(tableCellBorders1);
            return(tableCellProperties1);
        }
        internal void Process(TableCell cell, DocxTableProperties docxProperties, DocxNode node)
        {
            TableCellProperties cellProperties = new TableCellProperties();

            ProcessColSpan(node, cellProperties);
            ProcessWidth(node, cellProperties);

            if (HasRowSpan)
            {
                cellProperties.Append(new VerticalMerge()
                {
                    Val = MergedCellValues.Restart
                });
            }

            //Processing border should be after colspan
            ProcessBorders(node, docxProperties, cellProperties);

            string backgroundColor = node.ExtractStyleValue(DocxColor.backGroundColor);

            if (!string.IsNullOrEmpty(backgroundColor))
            {
                DocxColor.ApplyBackGroundColor(backgroundColor, cellProperties);
            }

            ProcessVerticalAlignment(node, cellProperties);

            if (cellProperties.HasChildren)
            {
                cell.Append(cellProperties);
            }
        }
Esempio n. 4
0
        public void SetBackgroundColorOfTableCell(SdtElement contentControl, string color = "D9D9D9")
        {
            if (contentControl == null)
            {
                throw new ArgumentNullException("contentControl");
            }

            var tableCell = contentControl.Parent.Parent as TableCell;

            if (tableCell != null)
            {
                var tableCellProperties = new TableCellProperties( );

                var shading =
                    tableCellProperties.AppendChild(new Shading( )
                {
                    Val       = ShadingPatternValues.Solid,
                    Color     = color,
                    Fill      = "FFFFFF",
                    ThemeFill = ThemeColorValues.Background1
                });

                tableCell.AppendChild(tableCellProperties);
            }
        }
Esempio n. 5
0
        private static void MergeCellsInColumn(int col)
        {
            TableCell tCell;

            TableCellProperties tcPropStart = new TableCellProperties();

            tcPropStart.Append(new VerticalMerge()
            {
                Val = MergedCellValues.Restart
            });

            TableCellProperties tcPropNext = new TableCellProperties();

            tcPropNext.Append(new VerticalMerge()
            {
                Val = MergedCellValues.Continue
            });

            foreach (TableRow tRow in tab.Elements <TableRow>())
            {
                tCell = tRow.Elements <TableCell>().ElementAt(col);

                if (IsEmptyCell(tCell))
                {
                    tCell.Append(tcPropNext.CloneNode(true));
                }
                else
                {
                    tCell.Append(tcPropStart.CloneNode(true));
                }
            }
        }
        // Creates an TableCellProperties instance and adds its children.
        public TableCellProperties Create(params OpenXmlElement[] newChildren)
        {
            TableCellProperties tableCellProperties = new TableCellProperties();

            tableCellProperties.Append(newChildren);
            return(tableCellProperties);
        }
        //____________________________________________________________________
        //
        /// <summary>
        /// Apply all the current Html tag to the specified table cell.
        /// </summary>
        public override void ApplyTags(OpenXmlCompositeElement tableCell)
        {
            if (tags.Count > 0)
            {
                TableCellProperties properties = tableCell.GetFirstChild<TableCellProperties>();
                if (properties == null) tableCell.PrependChild<TableCellProperties>(properties = new TableCellProperties());

                var en = tags.GetEnumerator();
                while (en.MoveNext())
                {
                    TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
                    foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
                        properties.Append(tag.CloneNode(true));
                }
            }

            // Apply some style attributes on the unique Paragraph tag contained inside a table cell.
            if (tagsParagraph.Count > 0)
            {
                Paragraph p = tableCell.GetFirstChild<Paragraph>();
                ParagraphProperties properties = p.GetFirstChild<ParagraphProperties>();
                if (properties == null) p.PrependChild<ParagraphProperties>(properties = new ParagraphProperties());

                var en = tagsParagraph.GetEnumerator();
                while (en.MoveNext())
                {
                    TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
                    foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
                        properties.Append(tag.CloneNode(true));
                }
            }
        }
        //.....................................................................
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private static TableCellProperties MakeCellStyle_01_02( )
        {
            TableCellProperties tableCellProperties2 = new TableCellProperties( );
            TableCellWidth      tableCellWidth2      = new TableCellWidth( )
            {
                Width = "2841", Type = TableWidthUnitValues.Dxa
            };

            TableCellBorders tableCellBorders2 = new TableCellBorders( );
            TopBorder        topBorder1        = new TopBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )18U, Space = ( UInt32Value )0U
            };
            LeftBorder leftBorder1 = new LeftBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )18U, Space = ( UInt32Value )0U
            };
            BottomBorder bottomBorder2 = new BottomBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )18U, Space = ( UInt32Value )0U
            };
            RightBorder rightBorder2 = new RightBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )18U, Space = ( UInt32Value )0U
            };

            tableCellBorders2.Append(topBorder1);
            tableCellBorders2.Append(leftBorder1);
            tableCellBorders2.Append(bottomBorder2);
            tableCellBorders2.Append(rightBorder2);

            tableCellProperties2.Append(tableCellWidth2);
            tableCellProperties2.Append(tableCellBorders2);
            return(tableCellProperties2);
        }
Esempio n. 9
0
        private TableCell CreateChoicesCell(List <CodeVM> codes, int firstCodesCount)
        {
            TableCellProperties tableCellProperties = new TableCellProperties();

            TableCellWidth tableCellWidth = new TableCellWidth()
            {
                Width = "0", Type = TableWidthUnitValues.Auto
            };

            tableCellProperties.Append(tableCellWidth);

            TableCell tableCell = new TableCell();

            tableCell.Append(tableCellProperties);

            foreach (CodeVM code in codes)
            {
                string    text      = ToChoiceString(code);
                Paragraph paragraph = CreateTextParagraph(text);
                tableCell.Append(paragraph);
            }

            int diff = firstCodesCount - codes.Count;

            if (diff != 0)
            {
                for (int i = 0; i < diff; i++)
                {
                    tableCell.Append(CreateEmptyParagraph());
                }
            }

            return(tableCell);
        }
Esempio n. 10
0
        private static TableCell CreateTableCell(string text, string backgroundColor = "", JustificationValues align = JustificationValues.Left, string width = "", string font = "", string fontSize = "", bool isBold = false, bool isUnderlines = false)
        {
            var cell = new TableCell();
            TableCellProperties tableCellProperties = new TableCellProperties()
            {
                TableCellVerticalAlignment = new TableCellVerticalAlignment {
                    Val = TableVerticalAlignmentValues.Center
                }
            };

            if (!string.IsNullOrWhiteSpace(backgroundColor))
            {
                tableCellProperties.Append(new Shading {
                    Color = "auto", Fill = backgroundColor, Val = ShadingPatternValues.Clear
                });
            }

            if (!string.IsNullOrWhiteSpace(width))
            {
                tableCellProperties.Append(new TableCellWidth {
                    Width = width
                });
            }

            cell.Append(CreateParagraph(text, align, font, fontSize, isBold));
            cell.Append(tableCellProperties);

            return(cell);
        }
        //____________________________________________________________________
        //

        /// <summary>
        /// Apply all the current Html tag to the specified table cell.
        /// </summary>
        public override void ApplyTags(OpenXmlCompositeElement tableCell)
        {
            if (tags.Count > 0)
            {
                TableCellProperties properties = tableCell.GetFirstChild <TableCellProperties>();
                if (properties == null)
                {
                    tableCell.PrependChild <TableCellProperties>(properties = new TableCellProperties());
                }

                var en = tags.GetEnumerator();
                while (en.MoveNext())
                {
                    TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
                    foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
                    {
                        SetProperties(properties, tag.CloneNode(true));
                    }
                }
            }

            // Apply some style attributes on the unique Paragraph tag contained inside a table cell.
            Paragraph p = tableCell.GetFirstChild <Paragraph>();

            paragraphStyle.ApplyTags(p);
        }
Esempio n. 12
0
        private Table CreateTable(int?rowCount, int?columnCount)
        {
            //Create table with border in specific lines and columns
            int   realRowCount    = GetRealRowCount(rowCount);
            int   realColumnCount = GetRealColumnCount(columnCount);
            Table table           = CreateDefaultTable();

            for (int r = 0; r < realRowCount; r++)
            {
                TableRow tableRow = new TableRow();
                table.Append(tableRow);

                for (int c = 0; c < realColumnCount; c++)
                {
                    TableCellProperties tableCellProperties = new TableCellProperties();
                    TableCellWidth      tableCellWidth      = new TableCellWidth()
                    {
                        Width = BOX_CELL_WIDTH.ToString(), Type = TableWidthUnitValues.Dxa
                    };
                    tableCellProperties.Append(tableCellWidth);

                    TableCell tableCell = new TableCell();
                    tableCell.Append(tableCellProperties);
                    tableCell.Append(new Paragraph());
                    tableRow.Append(tableCell);
                }
            }
            return(table);
        }
        //.....................................................................
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private static TableCellProperties MakeCellStyle_02_02( )
        {
            TableCellBorders tableCellBorders5 = new TableCellBorders( );

            TopBorder topBorder4 = new TopBorder( )
            {
                Val = BorderValues.Single, Color = "auto", Size = ( UInt32Value )18U, Space = ( UInt32Value )0U
            };

            LeftBorder leftBorder4 = new LeftBorder( )
            {
                Val = BorderValues.Nil
            };

            tableCellBorders5.Append(topBorder4);
            tableCellBorders5.Append(leftBorder4);

            TableCellProperties tableCellProperties5 = new TableCellProperties( );

            TableCellWidth tableCellWidth5 = new TableCellWidth( )
            {
                Width = "2841", Type = TableWidthUnitValues.Dxa
            };

            tableCellProperties5.Append(tableCellWidth5);
            tableCellProperties5.Append(tableCellBorders5);

            return(tableCellProperties5);
        }
		internal void Process(TableCell cell, DocxTableProperties docxProperties, DocxNode node)
		{
			TableCellProperties cellProperties = new TableCellProperties();

            ProcessColSpan(node, cellProperties);
            ProcessWidth(node, cellProperties);
			
			if (HasRowSpan)
			{
				cellProperties.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
			}
			
			//Processing border should be after colspan
            ProcessBorders(node, docxProperties, cellProperties);

            string backgroundColor = node.ExtractStyleValue(DocxColor.backGroundColor);
			
			if (!string.IsNullOrEmpty(backgroundColor))
			{
				DocxColor.ApplyBackGroundColor(backgroundColor, cellProperties);
			}

            ProcessVerticalAlignment(node, cellProperties);
			
			if (cellProperties.HasChildren)
			{
				cell.Append(cellProperties);
			}
		}
 public DocxDocumentCellContextBuilder(WordprocessingDocument document)
     : base(document)
 {
     contextTableCellProperties = new TableCellProperties(new TableCellWidth {
         Type = TableWidthUnitValues.Auto
     });
 }
Esempio n. 16
0
 /// <summary>
 /// Add border values to the cell properties
 /// </summary>
 /// <param name="cellProp"></param>
 /// <param name="cell"></param>
 /// <param name="isInAlternateRow"></param>
 private static void AddMargin(this TableCellProperties cellProp, Cell cell)
 {
     if (cell.Margin != null)
     {
         cellProp.AppendChild(new TableCellMargin()
         {
             LeftMargin = new LeftMargin()
             {
                 Width = cell.Margin.Left.ToString(CultureInfo.InvariantCulture), Type = TableWidthUnitValues.Dxa
             },
             TopMargin = new TopMargin()
             {
                 Width = cell.Margin.Top.ToString(CultureInfo.InvariantCulture), Type = TableWidthUnitValues.Dxa
             },
             RightMargin = new RightMargin()
             {
                 Width = cell.Margin.Right.ToString(CultureInfo.InvariantCulture), Type = TableWidthUnitValues.Dxa
             },
             BottomMargin = new BottomMargin()
             {
                 Width = cell.Margin.Bottom.ToString(CultureInfo.InvariantCulture), Type = TableWidthUnitValues.Dxa
             }
         });
     }
 }
Esempio n. 17
0
        private void AddCell(OpenXmlCompositeElement row, Action <ICellContextBuilder> options)
        {
            var tableCellProperties = new TableCellProperties(new TableCellWidth {
                Type = TableWidthUnitValues.Auto
            });

            AddCell(row, options, tableCellProperties);
        }
Esempio n. 18
0
 private void SetCellProperties(TableCellProperties cp)
 {
     if (Cell == null)
     {
         return;
     }
     Cell.TableCellProperties = cp;
 }
        public IDocumentTableSchemeBuilder Column(string columnName, float widthInPercents)
        {
            var width = Convert.ToInt32((widthInPercents*100)/15);
            var tableCellProperties = new TableCellProperties(new TableCellWidth { Type = TableWidthUnitValues.Pct, Width = width.ToString() });
            AddCell(headerRow, AddText(columnName), tableCellProperties);

            return this;
        }
Esempio n. 20
0
 /// <summary>
 /// Add border values to the cell properties
 /// </summary>
 /// <param name="cellProp"></param>
 /// <param name="cell"></param>
 /// <param name="isInAlternateRow"></param>
 private static void AddBorders(this TableCellProperties cellProp, Cell cell)
 {
     if (cell.Borders != null)
     {
         TableCellBorders borders = cell.Borders.RenderCellBorder();
         cellProp.AppendChild(borders);
     }
 }
Esempio n. 21
0
        public static TableRow CreateTableRowWithSomeStyles(List <string> values, int fontSize, bool isBold, JustificationValues justification = JustificationValues.Left)
        {
            TableRow tr = new TableRow();

            var count = values.Count;

            foreach (var val in values)
            {
                // Create a cell.
                TableCell tc = new TableCell();

                var props = new TableCellProperties(new TableCellWidth()
                {
                    Width = new StringValue
                    {
                        Value = $"{WidthForTable / count}"
                    },
                    Type = TableWidthUnitValues.Dxa
                },
                                                    new TableCellMargin
                                                    (
                                                        new TableCellLeftMargin
                {
                    Width = 108,
                    Type  = new EnumValue <TableWidthValues>(TableWidthValues.Dxa)
                },
                                                        new TableCellRightMargin
                {
                    Width = 108,
                    Type  = new EnumValue <TableWidthValues>(TableWidthValues.Dxa)
                }
                                                    ));

                tc.Append(props);

                var run = GetRun(fontSize, isBold);

                run.Append(new Text(val));

                var para = new Paragraph(run);

                para.Append(new ParagraphProperties
                {
                    Justification = new Justification
                    {
                        Val = new EnumValue <JustificationValues>(justification)
                    }
                });

                // Specify the table cell content.
                tc.Append(para);

                // Append the table cell to the table row.
                tr.Append(tc);
            }

            return(tr);
        }
Esempio n. 22
0
        //.....................................................................
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private TableCell MakeElem4( )
        {
            //---------------------------------------------
            TableCell tableCell4 = new TableCell( );

            TableCellProperties tableCellProperties4 = new TableCellProperties( );

            TableCellWidth tableCellWidth4 = new TableCellWidth( )
            {
                Width = "2840", Type = TableWidthUnitValues.Dxa
            };
            TableCellVerticalAlignment tableCellVerticalAlignment4 = new TableCellVerticalAlignment( )
            {
                Val = TableVerticalAlignmentValues.Center
            };

            tableCellProperties4.Append(tableCellWidth4);
            tableCellProperties4.Append(tableCellVerticalAlignment4);

            //---------------------------------------------
            Paragraph paragraph4 = new Paragraph( )
            {
                RsidParagraphAddition = "00B721D5", RsidParagraphProperties = "00B721D5", RsidRunAdditionDefault = "00B721D5"
            };

            ParagraphProperties paragraphProperties4 = new ParagraphProperties( );
            Justification       justification4       = new Justification( )
            {
                Val = JustificationValues.Right
            };

            paragraphProperties4.Append(justification4);

            //---------------------------------------------
            Run run4 = new Run( );

            RunProperties runProperties4 = new RunProperties( );
            RunFonts      runFonts2      = new RunFonts( )
            {
                Hint = FontTypeHintValues.EastAsia
            };

            runProperties4.Append(runFonts2);
            Text text4 = new Text( );

            text4.Text = "123";

            run4.Append(runProperties4);
            run4.Append(text4);

            //---------------------------------------------
            paragraph4.Append(paragraphProperties4);
            paragraph4.Append(run4);

            tableCell4.Append(tableCellProperties4);
            tableCell4.Append(paragraph4);
            return(tableCell4);
        }
Esempio n. 23
0
        public static TableRow GetTableRow(string[] data, int[] widths = null, bool header = false, bool verticalText = false)
        {
            var tr = new TableRow();

            for (int i = 0; i < data.Length; i++)
            {
                string d   = data[i];
                var    tc  = new TableCell();
                var    run = new Run(new Text(d));
                if (header)
                {
                    run.RunProperties = new RunProperties(new Bold());
                }
                var par = new Paragraph(run);

                ApplyStyleToParagraph(par, "TableContents");
                if (widths != null && widths.Length == data.Length)
                {
                    var tabProps =
                        new TableCellProperties(
                            new TableCellWidth {
                        Type = TableWidthUnitValues.Pct, Width = $"{widths[i] * 50 }"
                    },
                            new TableCellVerticalAlignment {
                        Val = TableVerticalAlignmentValues.Center
                    });
                    if (verticalText)
                    {
                        tabProps.AppendChild(new TextDirection()
                        {
                            Val = TextDirectionValues.BottomToTopLeftToRight
                        });
                    }
                    tc.Append(tabProps);
                }
                else
                {
                    var tabProps = new TableCellProperties(new TableCellWidth {
                        Type = TableWidthUnitValues.Auto
                    });
                    if (verticalText)
                    {
                        tabProps.AppendChild(new TextDirection()
                        {
                            Val = TextDirectionValues.BottomToTopLeftToRight
                        });
                        tabProps.AppendChild(new TableRowHeight()
                        {
                            Val = Convert.ToUInt32("1500")
                        });
                    }
                    tc.Append(tabProps);
                }
                tc.Append(par);
                tr.Append(tc);
            }
            return(tr);
        }
 public static WordDocumentWriter PrintTableCell(this WordDocumentWriter docWriter, string text,
                                                 TableCellProperties cellProperties = null, ParagraphProperties paragraphProperties = null, Font font = null)
 {
     cellProperties = cellProperties ?? docWriter.CreateTableCellProperties();
     docWriter.StartTableCell(cellProperties);
     docWriter.PrintParagraph(text, paragraphProperties, font);
     docWriter.EndTableCell();
     return(docWriter);
 }
Esempio n. 25
0
        public static TableCellProperties DataCellFormat()
        {
            TableCellProperties tcp = new TableCellProperties(new VerticalTextAlignmentOnPage()
            {
                Val = VerticalJustificationValues.Center
            });

            return(tcp);
        }
Esempio n. 26
0
        //.....................................................................
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private TableCell MakeElem2( )
        {
            TableCell tableCell2 = new TableCell( );

            TableCellProperties tableCellProperties2 = SetElemVertCenterWidth(2841);

            Paragraph paragraph2 = new Paragraph( )
            {
                RsidParagraphMarkRevision = "00B721D5", RsidParagraphAddition = "00B721D5", RsidParagraphProperties = "00B721D5", RsidRunAdditionDefault = "00B721D5"
            };

            ParagraphProperties paragraphProperties2 = new ParagraphProperties( );

            Justification justification2 = new Justification( )
            {
                Val = JustificationValues.Center
            };

            ParagraphMarkRunProperties paragraphMarkRunProperties2 = ParaMarkRunBold( );

            paragraphProperties2.Append(justification2);
            paragraphProperties2.Append(paragraphMarkRunProperties2);

            //---------------------------------------------
            Run run2 = new Run( )
            {
                RsidRunProperties = "00B721D5"
            };

            RunProperties runProperties2 = new RunProperties( );

            Bold  bold4  = new Bold( );
            Color color4 = new Color( )
            {
                Val = "FF0000"
            };

            runProperties2.Append(bold4);
            runProperties2.Append(color4);

            Text text2 = new Text( );

            text2.Text = "名称";

            run2.Append(runProperties2);
            run2.Append(text2);

            //---------------------------------------------
            paragraph2.Append(paragraphProperties2);
            paragraph2.Append(run2);

            tableCell2.Append(tableCellProperties2);
            tableCell2.Append(paragraph2);

            return(tableCell2);
        }
Esempio n. 27
0
        private static TableCell SetupCell(HetOwner owner, double widthInCm, double start)
        {
            try
            {
                var tableCell = new TableCell();

                var tableCellProperties = new TableCellProperties();
                tableCellProperties.AppendChild(new TableCellWidth {
                    Width = CentimeterToDxa(widthInCm).ToString(), Type = TableWidthUnitValues.Dxa
                });
                tableCellProperties.AppendChild(new TableCellVerticalAlignment()
                {
                    Val = TableVerticalAlignmentValues.Center
                });
                tableCell.AppendChild(tableCellProperties);

                var paragraphProperties = new ParagraphProperties();

                var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
                paragraphMarkRunProperties.AppendChild(new Color {
                    Val = "000000"
                });
                paragraphMarkRunProperties.AppendChild(new RunFonts {
                    Ascii = "Arial"
                });
                paragraphMarkRunProperties.AppendChild(new FontSize()
                {
                    Val = "13pt"
                });
                paragraphProperties.AppendChild(paragraphMarkRunProperties);

                paragraphProperties.AppendChild(new Justification {
                    Val = JustificationValues.Left
                });
                paragraphProperties.AppendChild(new Indentation {
                    Start = CentimeterToDxa(start).ToString()
                });

                var paragraph = new Paragraph();
                paragraph.AppendChild(paragraphProperties);

                if (owner != null)
                {
                    PopulateParagraph(owner, paragraph);
                }

                tableCell.AppendChild(paragraph);

                return(tableCell);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Esempio n. 28
0
        private TableCellProperties SecondCells()
        {
            TableCellProperties cellTwoProperties = new TableCellProperties();

            cellTwoProperties.Append(new HorizontalMerge
            {
                Val = MergedCellValues.Continue
            });
            return(cellTwoProperties);
        }
Esempio n. 29
0
        private TableCellProperties FirstCells()
        {
            TableCellProperties cellOneProperties = new TableCellProperties();

            cellOneProperties.Append(new HorizontalMerge
            {
                Val = MergedCellValues.Restart
            });
            return(cellOneProperties);
        }
Esempio n. 30
0
        public IDocumentTableSchemeBuilder Column(string columnName, float widthInPercents)
        {
            var width = Convert.ToInt32((widthInPercents * 100) / 15);
            var tableCellProperties = new TableCellProperties(new TableCellWidth {
                Type = TableWidthUnitValues.Pct, Width = width.ToString()
            });

            AddCell(headerRow, AddText(columnName), tableCellProperties);

            return(this);
        }
Esempio n. 31
0
 /// <summary>
 /// Add shading value to the cell properties
 /// </summary>
 /// <param name="cellProp"></param>
 /// <param name="cell"></param>
 /// <param name="isInAlternateRow"></param>
 private static void AddShading(this TableCellProperties cellProp, Cell cell)
 {
     if (!string.IsNullOrEmpty(cell.Shading))
     {
         cellProp.Shading = new Shading()
         {
             Fill = cell.Shading
         }
     }
     ;
 }
Esempio n. 32
0
        /// <summary>
        ///  Initialize new cell header object.
        /// </summary>
        /// <param name="textValue">The content of cell.</param>
        /// <returns>The TableCell object.</returns>
        public virtual TableCell NewTableCellHeader(string textValue, string width = "")
        {
            //create cell object and its properties
            TableCell tableCell = new TableCell();

            TableCellProperties tableCellProperties = new TableCellProperties();

            //ConditionalFormatStyle conditionalFormatStyle = new ConditionalFormatStyle() { Val = "001000000000" };
            if (!string.IsNullOrEmpty(width))
            {
                TableCellWidth tableCellWidth = new TableCellWidth()
                {
                    Width = width, Type = TableWidthUnitValues.Dxa
                };
                tableCellProperties.Append(tableCellWidth);
            }

            //tableCellProperties.Append(hideMark);

            //create paragrpah object and its properties
            Paragraph paragraph = new Paragraph();

            ParagraphProperties paragraphProperties = new ParagraphProperties();
            Justification       justification       = new Justification()
            {
                Val = JustificationValues.Center
            };

            paragraphProperties.Append(justification);

            //create Run and Text
            Run run = new Run();

            DocumentFormat.OpenXml.Wordprocessing.RunProperties runProperties = new DocumentFormat.OpenXml.Wordprocessing.RunProperties();
            runProperties.Append(new DocumentFormat.OpenXml.Wordprocessing.Bold());
            Text text = new Text();

            //add content in Text
            text.Text = textValue;
            // Set RunProperties
            run.RunProperties = runProperties;
            //add Text to Run
            run.Append(text);

            //add Run to paragraph
            paragraph.Append(paragraphProperties);
            paragraph.Append(run);

            //add Paragraph to cell
            tableCell.Append(tableCellProperties);
            tableCell.Append(paragraph);

            return(tableCell);
        }
        private void ProcessColSpan(DocxNode node, TableCellProperties cellProperties)
		{
			Int32 value;

            if (Int32.TryParse(node.ExtractAttributeValue(colspan), out value))
			{
				if (value > 1)
				{
					cellProperties.Append(new GridSpan() { Val = value });
				}
			}
		}
        void shapkaCorrector(TableRow shapka)
        {
            TableRowProperties tbRp = new TableRowProperties(new TableHeader());

            shapka.PrependChild(tbRp);
            foreach (TableCell cell in shapka.Elements <TableCell>())
            {
                TableCellProperties tbcPr = (TableCellProperties)cell.Elements <TableCellProperties>().FirstOrDefault().CloneNode(true);
                if (tbcPr.Elements <Justification>().Count() > 0)
                {
                    tbcPr.Elements <Justification>().FirstOrDefault().Val = JustificationValues.Center;
                }
                if (tbcPr.Elements <Shading>().Count() > 0)
                {
                    tbcPr.Elements <Shading>().FirstOrDefault().Color = "ffffff";
                    tbcPr.Elements <Shading>().FirstOrDefault().Fill  = "ffffff";
                    tbcPr.Elements <Shading>().FirstOrDefault().Val   = ShadingPatternValues.Clear;
                }
                cell.PrependChild(tbcPr);
                if (cell.Elements <TableCellProperties>().Count() > 1)
                {
                    cell.RemoveChild(cell.Elements <TableCellProperties>().Last());
                }

                foreach (Paragraph para in cell.Elements <Paragraph>())
                {
                    if (para.Elements <ParagraphProperties>().Count() > 0)
                    {
                        para.RemoveChild(para.Elements <ParagraphProperties>().Last());
                    }
                    foreach (Run run in para.Elements <Run>())
                    {
                        RunProperties rPr = new RunProperties(new RunFonts()
                        {
                            Ascii = "Times New Roman", HighAnsi = "Times New Roman"
                        },
                                                              new FontSize()
                        {
                            Val = "24"
                        },
                                                              new Color()
                        {
                            Val = "000000"
                        });
                        run.PrependChild(rPr);
                        if (run.Elements <RunProperties>().Count() > 1)
                        {
                            run.RemoveChild(run.Elements <RunProperties>().Last());
                        }
                    }
                }
            }
        }
        private void ProcessVerticalAlignment(DocxNode node, TableCellProperties cellProperties)
		{
            string alignment = node.ExtractStyleValue(DocxAlignment.verticalAlign);
			
			if (!string.IsNullOrEmpty(alignment))
			{
				TableVerticalAlignmentValues value;
				
				if (DocxAlignment.GetCellVerticalAlignment(alignment, out value))
				{
					cellProperties.Append(new TableCellVerticalAlignment(){ Val = value });
				}
			}
		}
Esempio n. 36
0
        public static TableCell AddCell(OXMLParagraphWrap _paragraph)
        {
            var TC = new TableCell();

            var TCProperties = new TableCellProperties();
                var TCWidth = new TableCellWidth(){ Width = "0", Type = TableWidthUnitValues.Nil };  //говорим что ширину определяет Столбец
                var TCVertAlign = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            TCProperties.Append(TCWidth);
            TCProperties.Append(TCVertAlign);

            TC.Append(TCProperties);
            TC.Append(_paragraph.XMLParagraph);

            return TC;
        }
        private void ProcessBorders(DocxNode node, DocxTableProperties docxProperties,
			TableCellProperties cellProperties)
		{
            string borderStyle = node.ExtractStyleValue(DocxBorder.borderName);
            string leftBorder = node.ExtractStyleValue(DocxBorder.leftBorderName);
            string topBorder = node.ExtractStyleValue(DocxBorder.topBorderName);
            string rightBorder = node.ExtractStyleValue(DocxBorder.rightBorderName);
            string bottomBorder = node.ExtractStyleValue(DocxBorder.bottomBorderName);
			
			TableCellBorders cellBorders = new TableCellBorders();
			
			DocxBorder.ApplyBorders(cellBorders, borderStyle, leftBorder, topBorder, 
				rightBorder, bottomBorder, docxProperties.HasDefaultBorder);
			
			if (cellBorders.HasChildren)
			{
				cellProperties.Append(cellBorders);
			}
		}
Esempio n. 38
0
        private static void AddHeaderRow(DataTable table, Table wordTable, TableStyle tableStyle)
        {
            // Create a row.
            TableRow tRow = new TableRow();

            foreach (DataColumn iColumn in table.Columns) {

                // Create a cell.
                TableCell tCell = new TableCell();

                TableCellProperties tCellProperties = new TableCellProperties();

                // Set Cell Color
                Shading tCellColor = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = System.Drawing.ColorTranslator.ToHtml(tableStyle.HeaderBackgroundColor) };
                tCellProperties.Append(tCellColor);

                // Append properties to the cell
                tCell.Append(tCellProperties);

                ParagraphProperties paragProperties = new ParagraphProperties();
                Justification justification1 = new Justification() { Val = JustificationValues.Center };
                SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0" };
                paragProperties.Append(spacingBetweenLines1);
                paragProperties.Append(justification1);

                var parag = new Paragraph();
                parag.Append(paragProperties);

                var run = new Run(new Text(iColumn.ColumnName));
                ApplyFontProperties(tableStyle, RowIdentification.Header, run);
                parag.Append(run);

                // Specify the table cell content.
                tCell.Append(parag);

                // Append the table cell to the table row.
                tRow.Append(tCell);
            }

            // Append the table row to the table.
            wordTable.Append(tRow);
        }
        private void ProcessWidth(DocxNode node, TableCellProperties cellProperties)
		{
            string width = node.ExtractStyleValue(DocxUnits.width);
			
			if (!string.IsNullOrEmpty(width))
			{
				decimal value;
				TableWidthUnitValues unit;
				
				if (DocxUnits.TableUnitsFromStyle(width, out value, out unit))
				{
					TableCellWidth cellWidth = new TableCellWidth() {
						Width = value.ToString(),
						Type = unit
					};
					
					cellProperties.Append(cellWidth);
				}
			}
		}
Esempio n. 40
0
		// Creates an TableCell instance and adds its children.
		public static void AddSpacerCell(this TableRow row, string width = "173")
		{
			TableCell tableCell1 = new TableCell();

			TableCellProperties tableCellProperties1 = new TableCellProperties();
			TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = width, Type = TableWidthUnitValues.Dxa };

			tableCellProperties1.Append(tableCellWidth1);

			Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "005A43FA", RsidParagraphProperties = "005A43FA", RsidRunAdditionDefault = "005A43FA" };

			ParagraphProperties paragraphProperties1 = new ParagraphProperties();
			Indentation indentation1 = new Indentation() { Left = "95", Right = "95" };

			paragraphProperties1.Append(indentation1);

			paragraph1.Append(paragraphProperties1);

			tableCell1.Append(tableCellProperties1);
			tableCell1.Append(paragraph1);
			row.Append(tableCell1);
		}
        public override IEnumerable<OpenXmlElement> ToOpenXmlElements(DocumentFormat.OpenXml.Packaging.MainDocumentPart mainDocumentPart)
        {
            TableCell result = new TableCell();
            var cellProperties = new TableCellProperties();

            if (!Width.IsEmpty)
            {
                var cellWidth = UnitHelper.Convert(Width).To<TableCellWidth>();
                cellProperties.Append(cellWidth);
            }

            if (Colspan.HasValue)
            {
                var gridSpan = new GridSpan() { Val = Colspan };
                cellProperties.Append(gridSpan);
            }

            result.Append(cellProperties);

            var paraContent = new Paragraph();
            ForEachChild(x =>
            {
                if (x is TextFormattedElement)
                {
                    paraContent.Append(
                        new Run(x.ToOpenXmlElements(mainDocumentPart))
                    );

                }
                else
                {
                    paraContent.Append(x.ToOpenXmlElements(mainDocumentPart));
                }
            });
            result.Append(paraContent);
            return new List<OpenXmlElement> { result };
        }
        private TableCell CreateLastNoBorderCell()
        {
            TableCellProperties tableCellProperties = new TableCellProperties();

            TableCellWidth tableCellWidth = new TableCellWidth() { Type = TableWidthUnitValues.Auto };
            TableCellBorders tableCellBorders1 = new TableCellBorders();
            TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Nil };
            LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.Nil };
            BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Nil };
            RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.Nil };

            tableCellBorders1.Append(topBorder1);
            tableCellBorders1.Append(leftBorder1);
            tableCellBorders1.Append(bottomBorder1);
            tableCellBorders1.Append(rightBorder1);

            tableCellProperties.Append(tableCellWidth);
            tableCellProperties.Append(tableCellBorders1);

            TableCell tableCell = new TableCell();
            tableCell.Append(tableCellProperties);
            tableCell.Append(CreateEmptyParagraph());
            return tableCell;
        }
        private TableCell CreateNoBorderCell(string text)
        {
            TableCellProperties tableCellProperties = new TableCellProperties();
            int cellWidth = CalcTextWidth(text.Length);

            TableCellWidth tableCellWidth = new TableCellWidth() { Width = cellWidth.ToString(), Type = TableWidthUnitValues.Dxa };
            TableCellBorders tableCellBorders1 = new TableCellBorders();
            TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Nil };
            LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.Nil };
            BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Nil };
            RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.Nil };

            tableCellBorders1.Append(topBorder1);
            tableCellBorders1.Append(leftBorder1);
            tableCellBorders1.Append(bottomBorder1);
            tableCellBorders1.Append(rightBorder1);

            tableCellProperties.Append(tableCellWidth);
            tableCellProperties.Append(tableCellBorders1);

            TableCell tableCell = new TableCell();
            tableCell.Append(tableCellProperties);
            tableCell.Append(CreateTextParagraph(text));
            return tableCell;
        }
        private TableCell CreateCenterCell(List<string> contents)
        {
            TableCellProperties tableCellProperties = new TableCellProperties();
            //セルの幅の均等割はTableWidthUnitValues.Autoじゃなく、TableWidthUnitValues.Nilを使うのが正解?
            TableCellWidth tableCellWidth = new TableCellWidth() { Width = "0", Type = TableWidthUnitValues.Nil };
            tableCellProperties.Append(tableCellWidth);

            TableCell tableCell = new TableCell();
            tableCell.Append(tableCellProperties);

            foreach (string content in contents)
            {
                tableCell.Append(CreateCenterParagraph(content));
            }

            return tableCell;
        }
        private TableCell CreateChoicesCell(List<CodeVM> codes, int firstCodesCount)
        {
            TableCellProperties tableCellProperties = new TableCellProperties();

            TableCellWidth tableCellWidth = new TableCellWidth() { Width = "0", Type = TableWidthUnitValues.Auto };
            tableCellProperties.Append(tableCellWidth);

            TableCell tableCell = new TableCell();
            tableCell.Append(tableCellProperties);

            foreach (CodeVM code in codes)
            {
                string text = ToChoiceString(code);
                Paragraph paragraph = CreateTextParagraph(text);
                tableCell.Append(paragraph);
            }

            int diff = firstCodesCount - codes.Count;
            if (diff != 0)
            {
                for (int i = 0; i < diff; i++)
                {
                    tableCell.Append(CreateEmptyParagraph());
                }
            }

            return tableCell;
        }
 private void AddCell(OpenXmlCompositeElement row, Action<ICellContextBuilder> options)
 {
     var tableCellProperties = new TableCellProperties(new TableCellWidth { Type = TableWidthUnitValues.Auto });
     AddCell(row, options, tableCellProperties);
 }
 private TableCell CreateBorderCell(string text)
 {
     int cellWidth = CalcTextWidth(text.Length);
     TableCellProperties tableCellProperties = new TableCellProperties();
     EnumValue<TableWidthUnitValues> type = cellWidth == 0 ? TableWidthUnitValues.Auto : TableWidthUnitValues.Dxa;
     TableCellWidth tableCellWidth = new TableCellWidth() { Width = cellWidth.ToString(), Type = type };
     tableCellProperties.Append(tableCellWidth);
     TableCell tableCell = new TableCell();
     tableCell.Append(tableCellProperties);
     tableCell.Append(CreateTextParagraph(text));
     return tableCell;
 }
Esempio n. 48
0
        private void GenerateChapterTwo()
        {
            var titlePage = _sessionObjects.TitlePage;

            var paragraph = new Paragraph();
            var runProp = new RunProperties();
            var run = new Run();
            var runs = new List<Run>();

            run.Append(new Text("2. Место учебной дисциплины в структуре основной образовательной программы"));
            var paraProp = GetParagraphProperties("Header1");
            GenerateParagraph(run, paraProp);

            paragraph = new Paragraph();
            paragraph.Append(GetParagraphProperties());
            run = new Run();
            var str = String.Format("Учебная дисциплина «{0}» – дисциплина ", titlePage.Discipline);
            run.Append(new Text(str) { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            runProp = new RunProperties { Color = new Color { Val = "FF0000" } };
            run.Append(runProp);
            run.Append(new Text("{описать к какому блоку и циклу принадлежит дисциплина}" ){ Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            str = String.Format(" федерального государственного образовательного стандарта подготовки {0}ов по направлению «", titlePage.Qualification);
            run.Append(new Text(str) { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            runProp = new RunProperties { Color = new Color { Val = "FF0000" } };
            run.Append(runProp);
            run.Append(new Text("{написать направление}") { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            str = String.Format("».", titlePage.Qualification);
            run.Append(new Text(str) { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            _body.Append(paragraph);

            var discipline = _additionalObjects.Discipline;
            var num = 0;
            if(discipline.Semesters.Count != 0)
            {
                for(var i = 0; i < discipline.Semesters.Count; i++)
                {
                    num += discipline.Semesters[i].Number;
                }
            }
            var courseNumber = Math.Ceiling( (double)(num / 2) );
            paragraph = new Paragraph();
            paragraph.Append(GetParagraphProperties());
            run = new Run();
            str = String.Format("Дисциплина изучается на {0} курсе, базируется на знаниях студентов, полученных в процессе изучения дисциплин: ", courseNumber);
            run.Append(new Text(str) { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            runProp = new RunProperties { Color = new Color { Val = "FF0000" } };
            run.Append(runProp);
            run.Append(new Text("{название дисциплин}") { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            str = String.Format(" и может служить основой для изучения следующих учебных дисциплин: ");
            run.Append(new Text(str) { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);
            run = new Run();
            runProp = new RunProperties { Color = new Color { Val = "FF0000" } };
            run.Append(runProp);
            run.Append(new Text("{название дисциплин}") { Space = SpaceProcessingModeValues.Preserve });
            paragraph.Append(run);

            GenerateParagraph();

            #region table
            var chapterFour = _sessionObjects.ChapterFour;
            var numOfColumn = 10;
            if (chapterFour.Chapters.Rows.Count != 0)
            {
                numOfColumn = chapterFour.Chapters.Rows.Count;
            }

            var table = new Table();
            table.Append(GenerateTableProperties());
            var tableGrid1 = new TableGrid();
            var gridColumn = new GridColumn { Width = "3969" };
            tableGrid1.Append(gridColumn);
            for (var i = 0; i < numOfColumn; i++)
            {
                var gridColumn1 = new GridColumn{ Width = "400" };
                tableGrid1.Append(gridColumn1);
            }
            table.Append(tableGrid1);

            #region Шапка
            #region row
            var tableRow = new TableRow();

            #region cell
            var tableCell = new TableCell();
            TableCellProperties tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });

            tableCell.Append(tableCellProperties1);
            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            var spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            var justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold()
            };
            run.Append(runProp);
            run.Append(new Text("Наименование обеспечиваемых (последующих) дисциплин"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new GridSpan() { Val = numOfColumn });
            tableCell.Append(tableCellProperties1);
            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("№ разделов данной дисциплины, необходимых для изучения обеспечиваемых (последующих) дисциплин"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            table.Append(tableRow);
            #endregion

            #region row
            tableRow = new TableRow();

            #region cell
            tableCell = new TableCell();
            var tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            for (var i = 0; i < numOfColumn; i++)
            {
                #region cell
                tableCell = new TableCell();
                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Center };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                runProp = new RunProperties
                {
                    Bold = new Bold(),
                };
                run.Append(runProp);
                run.Append(new Text((i + 1).ToString()));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion
            }

            table.Append(tableRow);
            #endregion
            #endregion

            #region данные
            for (var i = 0; i < 3; i++)
            {
                #region row
                tableRow = new TableRow();

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });

                tableCell.Append(tableCellProperties1);
                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Center };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                run.Append(new Text("Название дисциплины 1"));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                for (var j = 0; j < numOfColumn; j++)
                {
                    var rand = new Random(2);
                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);
                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Center };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run();
                    runProp = new RunProperties { Bold = new Bold() };
                    run.Append(runProp);
                    if (rand.Next() == 1)
                    {
                        run.Append(new Text("X"));
                    }
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion
                }
                table.Append(tableRow);
                #endregion
            }
            #endregion

            _body.Append(table);
            #endregion

            run = new Run();
            run.Append(new Break { Type = BreakValues.Page });
            GenerateParagraph();
        }
        private TableCell BuildCell(string text, int gridSpan = 1, VerticalMerge vm = null, bool bold = false)
        {
            TableCell cell = new TableCell();
            Paragraph p = new Paragraph();
            ParagraphProperties paragraphProperties = new ParagraphProperties();

            Justification justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);

            if (bold)
            {
                ParagraphMarkRunProperties paragraphMarkRunProperties = new ParagraphMarkRunProperties();
                Bold boldStyle = new Bold();

                paragraphMarkRunProperties.Append(boldStyle);
                paragraphProperties.Append(paragraphMarkRunProperties);
            }
            p.Append(paragraphProperties);

            if (!string.IsNullOrEmpty(text))
            {
                Run r = new Run();
                RunProperties runProperties = new RunProperties();

                if (bold)
                {
                    Bold boldStyle = new Bold();

                    runProperties.Append(boldStyle);
                }

                r.Append(runProperties);

                Text t = new Text { Text = text };
                r.AppendChild<Text>(t);

                p.AppendChild<Run>(r);
            }

            TableCellProperties cellProperty = new TableCellProperties();
            TableCellVerticalAlignment tableCellVerticalAlignment1 = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };

            cellProperty.Append(tableCellVerticalAlignment1);

            if (gridSpan > 1)
            {
                GridSpan gs = new GridSpan { Val = gridSpan };
                cellProperty.Append(gs);
            }

            if (vm != null)
            {
                cellProperty.Append(vm);
            }

            cell.Append(cellProperty);
            cell.Append(p);

            return cell;
        }
Esempio n. 50
0
        private void GenerateChapterFourTable2()
        {
            var chapterFour = (ChapterFour)_sessionObjects.ChapterFour;
            var discipline = (Discipline)_additionalObjects.Discipline;

            var paraProp = new ParagraphProperties();
            var paragraph = new Paragraph();
            var runProp = new RunProperties();
            var run = new Run();
            var runs = new List<Run>();

            var table = new Table();
            table.Append(GenerateTableProperties());

            var tableGrid1 = new TableGrid();
            tableGrid1.Append(new GridColumn { Width = "450" });
            tableGrid1.Append(new GridColumn { Width = "3100" });
            tableGrid1.Append(new GridColumn { Width = "800" });
            tableGrid1.Append(new GridColumn { Width = "450" });
            tableGrid1.Append(new GridColumn { Width = "600" });
            tableGrid1.Append(new GridColumn { Width = "600" });
            tableGrid1.Append(new GridColumn { Width = "600" });
            tableGrid1.Append(new GridColumn { Width = "600" });
            tableGrid1.Append(new GridColumn { Width = "650" });
            tableGrid1.Append(new GridColumn { Width = "600" });
            tableGrid1.Append(new GridColumn { Width = "600" });

            table.Append(tableGrid1);

            #region Шапка

            #region row
            var tableRow = new TableRow();

            #region cell
            var tableCell = new TableCell();
            TableCellProperties tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            var spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            var justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Номер раздела"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Наименование раздела / темы"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Обрабатываемые"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("компетенции"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Семестр"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Неделя семестра"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new GridSpan(){ Val = 6 });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Часов по учебной (рабочей) программе"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            table.Append(tableRow);
            #endregion

            #region row
            tableRow = new TableRow();

            #region cell
            tableCell = new TableCell();
            var tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Всего в уч. плане по разделу / теме"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new GridSpan(){ Val = 3 });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Аудиторная работа"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Самостоятельная"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("работа студента"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Экзамен"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            table.Append(tableRow);
            #endregion

            #region row
            tableRow = new TableRow();

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Всего"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new GridSpan(){ Val = 2 });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("В том числе"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            table.Append(tableRow);
            #endregion

            #region row
            tableRow = new TableRow();
            TableRowProperties tableRowProperties1 = new TableRowProperties();
            tableRowProperties1.Append(new TableRowHeight() { Val = (UInt32Value)1775U });
            tableRow.Append(tableRowProperties1);

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Лекции"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCellProperties1.Append(new TextDirection() { Val = TextDirectionValues.BottomToTopLeftToRight });
            tableCell.Append(tableCellProperties1);

            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
            };
            run.Append(runProp);
            run.Append(new Text("Практич. занятия"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProp = new TableCellProperties { VerticalMerge = new VerticalMerge() };
            tableCell.Append(tableCellProp);
            paragraph = new Paragraph();
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            table.Append(tableRow);
            #endregion
            #endregion

            #region Данные

            var dstTable = chapterFour.DistributionStudyTime;
            var dstSummTable = chapterFour.DistributionStudyTimeSumm;
            var chSummTable = chapterFour.ChaptersSumm;
            for (var k = 0; k < chSummTable.Rows.Count; k++)
            {
                #region row Раздел
                tableRow = new TableRow();

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                tableCell.Append(tableCellProperties1);

                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Center };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                runProp = new RunProperties { Bold = new Bold() };
                run.Append(runProp);
                run.Append(new Text(chSummTable.Rows[k]["ChapterIndex"].ToString()));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                tableCell.Append(tableCellProperties1);

                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Left };
                Indentation indentation = new Indentation() { Left = "87" };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                paraProp.Append(indentation);
                run = new Run();
                runProp = new RunProperties {
                    Italic = new Italic(),
                    Bold = new Bold()
                };
                run.Append(runProp);
                run.Append(new Text(chSummTable.Rows[k]["ChapterName"].ToString()));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                tableCell.Append(tableCellProperties1);

                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Left };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                tableCell.Append(tableCellProperties1);

                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Left };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                tableCell.Append(tableCellProperties1);

                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Left };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                for (var i = 2; i < chSummTable.Columns.Count; i++)
                {
                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Center };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run();
                    runProp = new RunProperties { Bold = new Bold() };
                    run.Append(runProp);
                    var num = Helper.ConvertObjectToInt(chSummTable.Rows[k][i]);
                    var str = "";
                    if(num != 0)
                    {
                        str = num.ToString();
                    }
                    run.Append(new Text(str));
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion
                }

                table.Append(tableRow);
                #endregion

                var indexTheme = 0;
                for (var i = 0; i < dstTable.Rows.Count; i++)
                {
                    if (Helper.ConvertObjectToInt(dstTable.Rows[i]["Номер раздела"]) == Helper.ConvertObjectToInt(chSummTable.Rows[k]["ChapterIndex"]))
                    {
                        indexTheme++;

                        #region row Тема
                        tableRow = new TableRow();

                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        paragraph = new Paragraph();
                        paraProp = GetParagraphProperties("TableStyle");
                        spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                        justification = new Justification() { Val = JustificationValues.Left };
                        paraProp.Append(spacingBetweenLines);
                        paraProp.Append(justification);
                        run = new Run();
                        paragraph.Append(paraProp);
                        paragraph.Append(run);
                        tableCell.Append(paragraph);
                        tableRow.Append(tableCell);
                        #endregion

                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        paragraph = new Paragraph();
                        paraProp = GetParagraphProperties("TableStyle");
                        spacingBetweenLines = new SpacingBetweenLines() { Line = "240", LineRule = LineSpacingRuleValues.Auto };
                        indentation = new Indentation() { Left = "87" };
                        justification = new Justification() { Val = JustificationValues.Left };
                        paraProp.Append(spacingBetweenLines);
                        paraProp.Append(indentation);
                        paraProp.Append(justification);
                        run = new Run();
                        var str = String.Format("Тема {0}.{1}. {2}",
                            Helper.ConvertObjectToInt(chSummTable.Rows[k]["ChapterIndex"]),
                            indexTheme,
                            dstTable.Rows[i]["Наименование темы"]
                            );
                        run.Append(new Text(str));
                        paragraph.Append(paraProp);
                        paragraph.Append(run);
                        tableCell.Append(paragraph);
                        tableRow.Append(tableCell);
                        #endregion

                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        #region компетенции
                        var competence = dstTable.Rows[i]["Компетенции"].ToString().Replace(" ", "").Split(',');
                        foreach (var c in competence)
                        {
                            paragraph = new Paragraph();
                            paraProp = GetParagraphProperties("TableStyle");
                            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                            justification = new Justification() { Val = JustificationValues.Center };
                            paraProp.Append(spacingBetweenLines);
                            paraProp.Append(justification);
                            run = new Run();
                            run.Append(new Text(c));
                            paragraph.Append(paraProp);
                            paragraph.Append(run);
                            tableCell.Append(paragraph);
                        }
                        if (competence.Length == 0)
                        {
                            paragraph = new Paragraph();
                            paraProp = GetParagraphProperties("TableStyle");
                            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                            justification = new Justification() { Val = JustificationValues.Center };
                            paraProp.Append(spacingBetweenLines);
                            paraProp.Append(justification);
                            run = new Run();
                            run.Append(new Text());
                            paragraph.Append(paraProp);
                            paragraph.Append(run);
                            tableCell.Append(paragraph);
                        }
                        #endregion

                        tableRow.Append(tableCell);
                        #endregion

                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        paragraph = new Paragraph();
                        paraProp = GetParagraphProperties("TableStyle");
                        spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                        justification = new Justification() { Val = JustificationValues.Center };
                        paraProp.Append(spacingBetweenLines);
                        paraProp.Append(justification);
                        run = new Run();
                        run.Append(new Text(dstTable.Rows[i]["Семестр"].ToString()));
                        paragraph.Append(paraProp);
                        paragraph.Append(run);
                        tableCell.Append(paragraph);
                        tableRow.Append(tableCell);
                        #endregion

                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        paragraph = new Paragraph();
                        paraProp = GetParagraphProperties("TableStyle");
                        spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                        justification = new Justification() { Val = JustificationValues.Center };
                        paraProp.Append(spacingBetweenLines);
                        paraProp.Append(justification);
                        run = new Run();
                        run.Append(new Text(dstTable.Rows[i]["Неделя семестра"].ToString()));
                        paragraph.Append(paraProp);
                        paragraph.Append(run);
                        tableCell.Append(paragraph);
                        tableRow.Append(tableCell);
                        #endregion

                        //dstSummTable
                        //обнаружил какой-то столбец ChapterIndex, уменьшил фор на 1
                        //dstSummTable.Columns.Count - 1
                        for (var j = 1; j < dstSummTable.Columns.Count - 1; j++)
                        {
                            #region cell
                            tableCell = new TableCell();
                            tableCellProperties1 = new TableCellProperties();
                            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                            tableCell.Append(tableCellProperties1);

                            paragraph = new Paragraph();
                            paraProp = GetParagraphProperties("TableStyle");
                            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                            justification = new Justification() { Val = JustificationValues.Center };
                            paraProp.Append(spacingBetweenLines);
                            paraProp.Append(justification);
                            run = new Run();
                            run.Append(new Text(dstSummTable.Rows[i][j].ToString()));
                            paragraph.Append(paraProp);
                            paragraph.Append(run);
                            tableCell.Append(paragraph);
                            tableRow.Append(tableCell);
                            #endregion
                        }

                        //dstTable
                        for (var j = 5; j < dstTable.Columns.Count; j++)
                        {
                            #region cell
                            tableCell = new TableCell();
                            tableCellProperties1 = new TableCellProperties();
                            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                            tableCell.Append(tableCellProperties1);

                            paragraph = new Paragraph();
                            paraProp = GetParagraphProperties("TableStyle");
                            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                            justification = new Justification() { Val = JustificationValues.Center };
                            paraProp.Append(spacingBetweenLines);
                            paraProp.Append(justification);
                            run = new Run();
                            run.Append(new Text(dstTable.Rows[i][j].ToString()));
                            paragraph.Append(paraProp);
                            paragraph.Append(run);
                            tableCell.Append(paragraph);
                            tableRow.Append(tableCell);
                            #endregion
                        }

                        //экзамен. пустая ячейка
                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        paragraph = new Paragraph();
                        paraProp = GetParagraphProperties("TableStyle");
                        spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                        justification = new Justification() { Val = JustificationValues.Center };
                        paraProp.Append(spacingBetweenLines);
                        paraProp.Append(justification);
                        run = new Run();
                        paragraph.Append(paraProp);
                        paragraph.Append(run);
                        tableCell.Append(paragraph);
                        tableRow.Append(tableCell);
                        #endregion

                        table.Append(tableRow);
                        #endregion
                    }
                }
            }

            #region Экзамены
            var chapterNum = chapterFour.Chapters.Rows.Count;
            for (var i = 0; i < discipline.Semesters.Count; i++)
            {
                if (discipline.Semesters[i].ValidationHours != 0)
                {
                    tableRow = new TableRow();

                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Left };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run(new Text(chapterNum.ToString()));
                    chapterNum++;
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion

                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Left };
                    var indentation = new Indentation() { Left = "87" };
                    paraProp.Append(indentation);
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    var str = "Подготовка к " + discipline.Semesters[i].Validation + "у";
                    run = new Run(new Text(str));
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion

                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Left };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run();
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion

                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Center };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run(new Text(discipline.Semesters[i].Number.ToString()));
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion

                    for (var z = 0; z < 6; z++)
                    {
                        #region cell
                        tableCell = new TableCell();
                        tableCellProperties1 = new TableCellProperties();
                        tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                        tableCell.Append(tableCellProperties1);

                        paragraph = new Paragraph();
                        paraProp = GetParagraphProperties("TableStyle");
                        spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                        justification = new Justification() { Val = JustificationValues.Left };
                        paraProp.Append(spacingBetweenLines);
                        paraProp.Append(justification);
                        run = new Run();
                        paragraph.Append(paraProp);
                        paragraph.Append(run);
                        tableCell.Append(paragraph);
                        tableRow.Append(tableCell);
                        #endregion
                    }

                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Center };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run(new Text(discipline.Semesters[i].ValidationHours.ToString()));
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion

                    table.Append(tableRow);
                }
            }
            #endregion

            var dstAllSummTable = chapterFour.DistributionStudyTimeCheckSumm;
            for (var i = 0; i < dstAllSummTable.Rows.Count; i++)
            {
                #region row общее количество часов
                tableRow = new TableRow();

                #region cell
                tableCell = new TableCell();
                tableCellProperties1 = new TableCellProperties();
                tableCellProperties1 = new TableCellProperties();
                Shading shading1 = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = "D9D9D9" };
                tableCellProperties1.Append(shading1);
                tableCellProperties1.Append(new GridSpan() { Val = 5 });
                tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                tableCell.Append(tableCellProperties1);

                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Center };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                runProp = new RunProperties
                {
                    Bold = new Bold(),
                };
                run.Append(runProp);
                run.Append(new Text(dstAllSummTable.Rows[i][0].ToString()));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                for (var j = 1; j < dstAllSummTable.Columns.Count; j++)
                {
                    #region cell
                    tableCell = new TableCell();
                    tableCellProperties1 = new TableCellProperties();
                    tableCellProperties1 = new TableCellProperties();
                    shading1 = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = "D9D9D9" };
                    tableCellProperties1.Append(shading1);
                    tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
                    tableCell.Append(tableCellProperties1);

                    paragraph = new Paragraph();
                    paraProp = GetParagraphProperties("TableStyle");
                    spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                    justification = new Justification() { Val = JustificationValues.Center };
                    paraProp.Append(spacingBetweenLines);
                    paraProp.Append(justification);
                    run = new Run();
                    runProp = new RunProperties
                    {
                        Bold = new Bold(),
                    };
                    run.Append(runProp);
                    var num = Helper.ConvertObjectToInt(dstAllSummTable.Rows[i][j]);
                    var str = "";
                    if (num != 0)
                    {
                        str = num.ToString();
                    }
                    run.Append(new Text(str));
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    tableCell.Append(paragraph);
                    tableRow.Append(tableCell);
                    #endregion
                }
                table.Append(tableRow);
                #endregion
            }

            #endregion

            _body.Append(table);

            GenerateParagraph();
        }
Esempio n. 51
0
        // Creates an Table instance and adds its children.
        public static Table GenerateTable(Document doc, System.Data.DataTable datetable)
        {
            Table table = new Table();
            //
            PageSize pagesize = doc.Body.Descendants<PageSize>().First();
            PageMargin pagemargin = doc.Body.Descendants<PageMargin>().First();
            //
            var AvailableSumWidth = (int)(pagesize.Width - pagemargin.Right - pagemargin.Left);

            TableBorders tborder = new Func<TableBorders>(delegate()
            {
                TableBorders tableBorders1 = new TableBorders();
                TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
                LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
                BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
                RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
                InsideHorizontalBorder insideHorizontalBorder1 = new InsideHorizontalBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
                InsideVerticalBorder insideVerticalBorder1 = new InsideVerticalBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };

                tableBorders1.Append(topBorder1);
                tableBorders1.Append(leftBorder1);
                tableBorders1.Append(bottomBorder1);
                tableBorders1.Append(rightBorder1);
                tableBorders1.Append(insideHorizontalBorder1);
                tableBorders1.Append(insideVerticalBorder1);
                return tableBorders1;
            })();

            table.AppendChild<TableProperties>(new TableProperties(
               new TableStyle() { Val = "a7" },
               tborder,
               new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto },
               new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }
            ));

            int sumColumn = datetable.Columns.Count;

            int averwidth = AvailableSumWidth / sumColumn;

            Double set_colSumW = 0;
            int remainSumW = 0;
            foreach (System.Data.DataColumn item in datetable.Columns)
            {
                Object col_w = item.ExtendedProperties["width"];
                if (col_w != null) { set_colSumW += Convert.ToDouble(col_w); remainSumW += averwidth; }
            }

            foreach (System.Data.DataColumn item in datetable.Columns)
            {
                Object col_w = item.ExtendedProperties["width"];
                if (col_w != null) item.ExtendedProperties.Add("WordWidth", Math.Floor((remainSumW * Convert.ToDouble(col_w) / set_colSumW)));
                else item.ExtendedProperties.Add("WordWidth", averwidth);
            }

            for (int i = 0; i < sumColumn; i++)
            {
                int col_w = Convert.ToInt32(datetable.Columns[i].ExtendedProperties["WordWidth"]);
                table.AppendChild<GridColumn>(new GridColumn() { Width = col_w.ToString() });
            }
            List<System.Data.DataRow> lstCol = new List<System.Data.DataRow>();
            System.Data.DataRow dr = datetable.NewRow();
            List<object> lstObj = new List<object>();

            foreach (System.Data.DataColumn item in datetable.Columns)
            {
                lstObj.Add(item.ColumnName);
            }

            dr.ItemArray = lstObj.ToArray();
            datetable.Rows.InsertAt(dr, 0);

            foreach (System.Data.DataRow item in datetable.Rows)
            {
                TableRow tableRow = new TableRow() { RsidTableRowAddition = "00D24D12", RsidTableRowProperties = "00D24D12" };
                for (int i = 0; i < sumColumn; i++)
                {
                    int col_w = Convert.ToInt32(datetable.Columns[i].ExtendedProperties["WordWidth"]);

                    string cellValue = item[i].ToString();
                    TableCell tableCell1 = new TableCell();

                    TableCellProperties tableCellProperties1 = new TableCellProperties();
                    TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = col_w.ToString(), Type = TableWidthUnitValues.Dxa };

                    tableCellProperties1.Append(tableCellWidth1);

                    Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00D24D12", RsidParagraphProperties = "003246FB", RsidRunAdditionDefault = "00D24D12" };

                    Run run1 = new Run();

                    RunProperties runProperties1 = new RunProperties();
                    RunFonts runFonts1 = new RunFonts() { Hint = FontTypeHintValues.EastAsia };

                    runProperties1.Append(runFonts1);
                    Text text1 = new Text();
                    text1.Text = cellValue;

                    run1.Append(runProperties1);
                    run1.Append(text1);
                    BookmarkStart bookmarkStart1 = new BookmarkStart();
                    BookmarkEnd bookmarkEnd1 = new BookmarkEnd();

                    paragraph1.Append(run1);
                    paragraph1.Append(bookmarkStart1);
                    paragraph1.Append(bookmarkEnd1);

                    tableCell1.Append(tableCellProperties1);
                    tableCell1.Append(paragraph1);

                    tableRow.Append(tableCell1);
                }
                table.Append(tableRow);
            }
            return table;
        }
Esempio n. 52
0
        public TableRow GenerateTableFooterRow(CellProps[] cellProps, UInt32Value height)
        {
            // Add table row properties
            TableRow tableRow1 = new TableRow();
            TableRowProperties tableRowProperties1 = generateTableRowProperties(height);
            tableRow1.Append(tableRowProperties1);

            foreach (CellProps cp in cellProps) {
                if (cp.span == 0) continue;
                TableCell tableCell1 = new TableCell();
                TableCellProperties tableCellProperties1 = new TableCellProperties();
                TableCellBorders tableCellBorders1;

                if (cp.boxed) {
                    tableCellBorders1 = generateTableCellBordersBox();
                } else {
                    tableCellBorders1 = generateTableCellBordersPlain();
                }

                Shading shading1 = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = "auto" };
                NoWrap noWrap1 = new NoWrap();
                TableCellVerticalAlignment tableCellVerticalAlignment1 = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                HideMark hideMark1 = new HideMark();

                tableCellProperties1.Append(tableCellBorders1);
                tableCellProperties1.Append(shading1);
                tableCellProperties1.Append(noWrap1);
                tableCellProperties1.Append(tableCellVerticalAlignment1);
                tableCellProperties1.Append(hideMark1);

                Paragraph paragraph1 = new Paragraph();

                ParagraphProperties paragraphProperties1 = new ParagraphProperties();
                Justification justification1 = new Justification() { Val = JustificationValues.Right };

                ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
                Bold bold1 = new Bold();
                BoldComplexScript boldComplexScript1 = new BoldComplexScript();
                Color color1 = new Color() { Val = "333399" };
                FontSize fontSize1 = new FontSize() { Val = "18" };
                FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "18" };

                paragraphMarkRunProperties1.Append(bold1);
                paragraphMarkRunProperties1.Append(boldComplexScript1);
                paragraphMarkRunProperties1.Append(color1);
                paragraphMarkRunProperties1.Append(fontSize1);
                paragraphMarkRunProperties1.Append(fontSizeComplexScript1);

                paragraphProperties1.Append(justification1);
                paragraphProperties1.Append(paragraphMarkRunProperties1);

                Run run1 = new Run();

                RunProperties runProperties1 = new RunProperties();
                Bold bold2 = new Bold();
                BoldComplexScript boldComplexScript2 = new BoldComplexScript();
                Color color2 = new Color() { Val = "333399" };
                FontSize fontSize2 = new FontSize() { Val = "18" };
                FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "18" };

                runProperties1.Append(bold2);
                runProperties1.Append(boldComplexScript2);
                runProperties1.Append(color2);
                runProperties1.Append(fontSize2);
                runProperties1.Append(fontSizeComplexScript2);
                run1.Append(runProperties1);

                if (cp.text != null) {
                    Text text1 = new Text();
                    text1.Text = cp.text;
                    run1.Append(text1);
                }

                paragraph1.Append(paragraphProperties1);
                paragraph1.Append(run1);

                tableCell1.Append(tableCellProperties1);
                tableCell1.Append(paragraph1);
                tableRow1.Append(tableCell1);
            }
            return tableRow1;
        }
Esempio n. 53
0
        public TableRow GenerateTableRow(CellProps[] cellProps, UInt32Value height)
        {
            TableRow tableRow1 = new TableRow();
            TableRowProperties tableRowProperties1 = generateTableRowProperties(height);
            tableRow1.Append(tableRowProperties1);

            foreach (CellProps cp in cellProps) {
                if (cp.span == 0) continue;
                TableCell tableCell1 = new TableCell();
                TableCellProperties tableCellProperties1 = new TableCellProperties();

                TableCellBorders tableCellBorders1 = generateTableCellBordersPlain();
                Shading shading1 = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = "auto" };
                NoWrap noWrap1 = new NoWrap();
                TableCellVerticalAlignment tableCellVerticalAlignment1 = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                HideMark hideMark1 = new HideMark();

                if (cp.span > 1) {
                    GridSpan span = new GridSpan() { Val = (Int32Value)cp.span };
                    tableCellProperties1.Append(span);
                }

                tableCellProperties1.Append(tableCellBorders1);
                tableCellProperties1.Append(shading1);
                tableCellProperties1.Append(noWrap1);
                tableCellProperties1.Append(tableCellVerticalAlignment1);
                tableCellProperties1.Append(hideMark1);

                Paragraph paragraph1 = new Paragraph();

                ParagraphProperties paragraphProperties1 = new ParagraphProperties();
                Justification justification1 = new Justification() { Val = cp.align };

                ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
                FontSize fontSize1 = new FontSize() { Val = "18" };
                FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "18" };

                paragraphMarkRunProperties1.Append(fontSize1);
                paragraphMarkRunProperties1.Append(fontSizeComplexScript1);

                paragraphProperties1.Append(justification1);
                paragraphProperties1.Append(paragraphMarkRunProperties1);

                Run run1 = new Run();

                RunProperties runProperties1 = new RunProperties();
                FontSize fontSize2 = new FontSize() { Val = "18" };
                FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "18" };

                runProperties1.Append(fontSize2);
                runProperties1.Append(fontSizeComplexScript2);

                run1.Append(runProperties1);
                if (cp.text != null) {
                    Text text1 = new Text();
                    text1.Text = cp.text;
                    run1.Append(text1);
                }

                paragraph1.Append(paragraphProperties1);
                paragraph1.Append(run1);

                tableCell1.Append(tableCellProperties1);
                tableCell1.Append(paragraph1);
                tableRow1.Append(tableCell1);

            }

            return tableRow1;
        }
        private void AddCell(OpenXmlCompositeElement row, Action<ICellContextBuilder> options, TableCellProperties cellProperties)
        {
            var builder = new DocxDocumentCellContextBuilder(Document, cellProperties);

            options(builder);
            row.AppendChild(builder.ToElement());
        }
        private Table CreateTable(int? rowCount, int? columnCount)
        {
            //枠線、罫線ありの表を指定の行列分生成する
            int realRowCount = GetRealRowCount(rowCount);
            int realColumnCount = GetRealColumnCount(columnCount);
            Table table = CreateDefaultTable();
            for (int r = 0; r < realRowCount; r++)
            {
                TableRow tableRow = new TableRow();
                table.Append(tableRow);

                for (int c = 0; c < realColumnCount; c++)
                {
                    TableCellProperties tableCellProperties = new TableCellProperties();
                    TableCellWidth tableCellWidth = new TableCellWidth() { Width = BOX_CELL_WIDTH.ToString(), Type = TableWidthUnitValues.Dxa };
                    tableCellProperties.Append(tableCellWidth);

                    TableCell tableCell = new TableCell();
                    tableCell.Append(tableCellProperties);
                    tableCell.Append(new Paragraph());
                    tableRow.Append(tableCell);
                }
            }
            return table;
        }
        private Table GenerateBasiceReportDataTable()
        {
            Table table1 = new Table();

            TableProperties tableProperties1 = new TableProperties();
            TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" };
            TablePositionProperties tablePositionProperties1 = new TablePositionProperties() { LeftFromText = 180, RightFromText = 180, VerticalAnchor = VerticalAnchorValues.Text, HorizontalAnchor = HorizontalAnchorValues.Margin, TablePositionXAlignment = HorizontalAlignmentValues.Center, TablePositionY = 103 };
            TableWidth tableWidth1 = new TableWidth() { Width = "15026", Type = TableWidthUnitValues.Dxa };
            TableLook tableLook1 = new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true };

            tableProperties1.Append(tableStyle1);
            tableProperties1.Append(tablePositionProperties1);
            tableProperties1.Append(tableWidth1);
            tableProperties1.Append(tableLook1);

            TableGrid tableGrid1 = new TableGrid();
            GridColumn gridColumn1 = new GridColumn() { Width = "15026" };

            tableGrid1.Append(gridColumn1);

            TableRow tableRow1 = new TableRow() { RsidTableRowAddition = "004E307B", RsidTableRowProperties = "00D273DB" };

            TableCell tableCell1 = new TableCell();

            TableCellProperties tableCellProperties1 = new TableCellProperties();
            TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = "15026", Type = TableWidthUnitValues.Dxa };

            tableCellProperties1.Append(tableCellWidth1);

            Paragraph paragraph1 = new Paragraph() { RsidParagraphMarkRevision = "004E307B", RsidParagraphAddition = "004E307B", RsidParagraphProperties = "004E307B", RsidRunAdditionDefault = "004E307B" };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            Justification justification1 = new Justification() { Val = JustificationValues.Center };

            paragraphProperties1.Append(justification1);

            paragraph1.Append(paragraphProperties1);

            tableCell1.Append(tableCellProperties1);
            tableCell1.Append(paragraph1);

            tableRow1.Append(tableCell1);

            table1.Append(tableProperties1);
            table1.Append(tableGrid1);
            table1.Append(tableRow1);
            return table1;
        }
        private TableCell CreateUnderlineCell(int cellWidth)
        {
            TableCellProperties tableCellProperties8 = new TableCellProperties();
            TableCellWidth tableCellWidth8 = new TableCellWidth() { Width = cellWidth.ToString(), Type = TableWidthUnitValues.Dxa };

            TableCellBorders tableCellBorders1 = new TableCellBorders();
            TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Nil };
            LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.Nil };
            BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)2U, Space = (UInt32Value)0U };
            RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.Nil };

            tableCellBorders1.Append(topBorder1);
            tableCellBorders1.Append(leftBorder1);
            tableCellBorders1.Append(bottomBorder1);
            tableCellBorders1.Append(rightBorder1);

            tableCellProperties8.Append(tableCellWidth8);
            tableCellProperties8.Append(tableCellBorders1);

            TableCell tableCell = new TableCell();
            tableCell.Append(tableCellProperties8);
            tableCell.Append(CreateEmptyParagraph());
            return tableCell;
        }
 private TableCell CreateBorderCell(int cellWidth)
 {
     //ボーダーつきのセルを生成する(幅指定あり)
     TableCellProperties tableCellProperties = new TableCellProperties();
     EnumValue<TableWidthUnitValues> type = cellWidth == 0 ? TableWidthUnitValues.Auto : TableWidthUnitValues.Dxa;
     TableCellWidth tableCellWidth = new TableCellWidth() { Width = cellWidth.ToString(), Type = type };
     tableCellProperties.Append(tableCellWidth);
     TableCell tableCell = new TableCell();
     tableCell.Append(tableCellProperties);
     tableCell.Append(CreateEmptyParagraph());
     return tableCell;
 }
            private void AddTableCell(WordDocumentWriter documentWriter, TableCellProperties cellProperties, string cellText)
            {
                // Start a Cell
                documentWriter.StartTableCell(cellProperties);

                // Start a Paragraph and add a text run to the cell
                documentWriter.StartParagraph();
                documentWriter.AddTextRun(cellText);
                documentWriter.EndParagraph();

                // End the Cell
                documentWriter.EndTableCell();
            }
Esempio n. 60
0
        private void GenerateChapterSix23()
        {
            var paraProp = new ParagraphProperties();
            var paragraph = new Paragraph();
            var runProp = new RunProperties();
            var run = new Run();

            #region chapterSix23
            var chapterSix23 = _sessionObjects.ChapterSixPartTwoThree;
            runProp = new RunProperties
            {
                Bold = new Bold(),
                Italic = new Italic()
            };
            run.Append(runProp);
            run.Append(new Text(chapterSix23.SubHeader1));
            paraProp = GetParagraphProperties("StyleWithoutIndentation");
            GenerateParagraph(run, paraProp);

            #region table
            var table = new Table();
            table.Append(GenerateTableProperties());
            var tableGrid1 = new TableGrid();
            tableGrid1.Append(new GridColumn { Width = "1843" });
            tableGrid1.Append(new GridColumn { Width = "6716" });
            table.Append(tableGrid1);

            #region header
            #region row
            var tableRow = new TableRow();

            #region cell
            var tableCell = new TableCell();
            TableCellProperties tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });

            tableCell.Append(tableCellProperties1);
            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            var spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            var justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
                Italic = new Italic()
            };
            run.Append(runProp);
            run.Append(new Text("№ Занятия"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            #region cell
            tableCell = new TableCell();
            tableCellProperties1 = new TableCellProperties();
            tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
            tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
            tableCell.Append(tableCellProperties1);
            paragraph = new Paragraph();
            paraProp = GetParagraphProperties("TableStyle");
            spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            justification = new Justification() { Val = JustificationValues.Center };
            paraProp.Append(spacingBetweenLines);
            paraProp.Append(justification);
            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
                Italic = new Italic()
            };
            run.Append(runProp);
            run.Append(new Text("Тема смостоятельного занятия"));
            paragraph.Append(paraProp);
            paragraph.Append(run);
            tableCell.Append(paragraph);
            tableRow.Append(tableCell);
            #endregion

            table.Append(tableRow);
            #endregion
            #endregion

            #region data
            for (var i = 0; i < chapterSix23.IndependentWork.Rows.Count; i++)
            {
                #region row
                tableRow = new TableRow();

                #region cell
                tableCell = new TableCell();
                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Center };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                run.Append(new Text((i + 1).ToString()));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                #region cell
                tableCell = new TableCell();
                paragraph = new Paragraph();
                paraProp = GetParagraphProperties("TableStyle");
                spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
                justification = new Justification() { Val = JustificationValues.Center };
                paraProp.Append(spacingBetweenLines);
                paraProp.Append(justification);
                run = new Run();
                run.Append(new Text(chapterSix23.IndependentWork.Rows[i].ToString()));
                paragraph.Append(paraProp);
                paragraph.Append(run);
                tableCell.Append(paragraph);
                tableRow.Append(tableCell);
                #endregion

                table.Append(tableRow);
                #endregion
            }
            #endregion
            #endregion

            GenerateParagraph();

            run = new Run();
            runProp = new RunProperties
            {
                Bold = new Bold(),
                Italic = new Italic()
            };
            run.Append(runProp);
            run.Append(new Text(chapterSix23.SubHeader2));
            paraProp = GetParagraphProperties("StyleWithoutIndentation");
            GenerateParagraph(run, paraProp);

            foreach (var home in chapterSix23.HomeWork)
            {
                run = new Run();
                runProp = new RunProperties
                {
                    Bold = new Bold()
                };
                run.Append(runProp);
                run.Append(new Text(home.Rows[0]["Header"].ToString()));
                paraProp = GetParagraphProperties("StyleWithoutIndentation");
                GenerateParagraph(run, paraProp);

                for (var i = 0; i < home.Rows.Count; i++)
                {
                    paraProp = GetParagraphProperties();

                    run = new Run();
                    var str = String.Format("{0}. {1}", i + 1, home.Rows[i]["Text"]);
                    run.Append(new Text(str));

                    paragraph = new Paragraph();
                    paragraph.Append(paraProp);
                    paragraph.Append(run);
                    _body.Append(paragraph);
                }
            }
            #endregion
        }