Example #1
0
 public void Write(TextWriter output)
 {
     output.Write("<w:tblPr>");
     if (_borderTop != null || _borderBottom != null || _borderLeft != null || _borderRight != null)
     {
         output.Write("<w:tblBorders>");
         if (_borderTop != null)
         {
             _borderTop.Write(output, "top");
         }
         if (_borderLeft != null)
         {
             _borderLeft.Write(output, "left");
         }
         if (_borderBottom != null)
         {
             _borderBottom.Write(output, "bottom");
         }
         if (_borderRight != null)
         {
             _borderRight.Write(output, "right");
         }
         output.Write("</w:tblBorders>");
     }
     if (_bgColor != null)
     {
         output.Write("<w:shd w:val=\"clear\" w:fill=\"" + _bgColor + "\"/>");
     }
     if (!_autofit)
     {
         output.Write("<w:tblLayout w:type=\"fixed\"/>");
     }
     output.Write("<w:tblCellMar><w:top w:w=\"0\" w:type=\"dxa\"/><w:left w:w=\"0\" w:type=\"dxa\"/><w:bottom w:w=\"0\" w:type=\"dxa\"/><w:right w:w=\"0\" w:type=\"dxa\"/></w:tblCellMar></w:tblPr>");
 }
Example #2
0
        public override void Write(TextWriter output)
        {
            output.Write("<w:trPr>");
            if (_rowIndent > 0f)
            {
                output.Write("<w:wBefore w:w=\"");
                output.Write(WordOpenXmlUtils.ToTwips(_rowIndent, 0f, 31680f));
                output.Write("\" w:type=\"dxa\"/>");
            }
            long num = (long)WordOpenXmlUtils.ToTwips(_height) - (long)WordOpenXmlUtils.PointsToTwips(_maxPaddingTop, 0.0, 31680.0) - WordOpenXmlUtils.PointsToTwips(_maxPaddingBottom, 0.0, 31680.0);

            if (!_ignoreRowHeight && num > 0)
            {
                output.Write("<w:trHeight w:val=\"");
                output.Write(WordOpenXmlUtils.TwipsToString(num, 0, 31680));
                output.Write(_exactRowHeight ? "\" w:hRule=\"exact\"/>" : "\" w:hRule=\"atLeast\"/>");
            }
            output.Write("</w:trPr>");
            bool num2 = _borderTop != null || _borderBottom != null || _borderLeft != null || _borderRight != null;

            if (num2 || _bgColor != null)
            {
                output.Write("<w:tblPrEx>");
            }
            if (num2)
            {
                output.Write("<w:tblBorders>");
                if (_borderTop != null)
                {
                    _borderTop.Write(output, "top");
                }
                if (_borderLeft != null)
                {
                    _borderLeft.Write(output, "left");
                }
                if (_borderBottom != null)
                {
                    _borderBottom.Write(output, "bottom");
                }
                if (_borderRight != null)
                {
                    _borderRight.Write(output, "right");
                }
                output.Write("</w:tblBorders>");
            }
            if (_bgColor != null)
            {
                output.Write("<w:shd w:val=\"clear\" w:fill=\"");
                output.Write(_bgColor);
                output.Write("\"/>");
            }
            if (num2 || _bgColor != null)
            {
                output.Write("</w:tblPrEx>");
            }
        }
 public void Write(TextWriter output)
 {
     output.Write("<w:tcPr>");
     output.Write("<w:tcW w:w=\"");
     output.Write(WordOpenXmlUtils.TwipsToString(_width, 0, 31680));
     output.Write("\" w:type=\"dxa\"/>");
     if (_horizontalMerge == MergeState.Start)
     {
         output.Write("<w:hMerge w:val=\"restart\"/>");
     }
     else if (_horizontalMerge == MergeState.Continue)
     {
         output.Write("<w:hMerge w:val=\"continue\"/>");
     }
     if (_verticalMerge == MergeState.Start)
     {
         output.Write("<w:vMerge w:val=\"restart\"/>");
     }
     else if (_verticalMerge == MergeState.Continue)
     {
         output.Write("<w:vMerge w:val=\"continue\"/>");
     }
     if (_borderTop != null || _borderBottom != null || _borderLeft != null || _borderRight != null || _borderDiagonalUp != null || _borderDiagonalDown != null)
     {
         output.Write("<w:tcBorders>");
         if (_borderTop != null)
         {
             _borderTop.Write(output, "top");
         }
         if (_borderLeft != null)
         {
             _borderLeft.Write(output, "left");
         }
         if (_borderBottom != null)
         {
             _borderBottom.Write(output, "bottom");
         }
         if (_borderRight != null)
         {
             _borderRight.Write(output, "right");
         }
         if (_borderDiagonalDown != null)
         {
             _borderDiagonalDown.Write(output, "tl2br");
         }
         if (_borderDiagonalUp != null)
         {
             _borderDiagonalUp.Write(output, "tr2bl");
         }
         output.Write("</w:tcBorders>");
     }
     if (_bgColor != null)
     {
         output.Write("<w:shd w:val=\"clear\" w:fill=\"");
         output.Write(_bgColor);
         output.Write("\"/>");
     }
     WritePadding(output);
     if (_textOrientation == TextOrientationEnum.Rotate90)
     {
         output.Write("<w:textDirection w:val=\"tbRlV\"/>");
     }
     else if (_textOrientation == TextOrientationEnum.Rotate270)
     {
         output.Write("<w:textDirection w:val=\"btLr\"/>");
     }
     if (_verticalAlignment == VerticalAlign.Bottom)
     {
         output.Write("<w:vAlign w:val=\"bottom\"/>");
     }
     else if (_verticalAlignment == VerticalAlign.Middle)
     {
         output.Write("<w:vAlign w:val=\"center\"/>");
     }
     output.Write("</w:tcPr>");
 }